Mask Text Box - will not accept info from MS Access
New the forum but not the site. This is a VERY resourceful website.
Thanks to everyone that helps out!
I'm trying to retrieve info from a MS Access Database with a form in my program. The info in the database is phone numbers.
I'm trying to get it out of the database into the form to a Mask Edit.
Here is the code I'm using that doesn't work.
' recordset to compair text box with record
Dim rsSearch As ADODB.Recordset
Set rsSearch = New ADODB.Recordset
With rsSearch
.ActiveConnection = conAircraft_Caddy
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.Source = "SELECT * FROM Fields WHERE (Fields.fldFieldName) like '" & lblFName.Caption & "'"
.Open
' if end of file is true then display message and return to main form
If rsSearch.EOF = True Then
On Error GoTo SaveErrorHandler:
' error handler
SaveErrorHandler:
'display msgbox "not found"
gstrMessage = "That name was not found in the database."
gstrTitle = "Search By Record"
gintStyle = vbOKOnly
gintResponse = MsgBox(gstrMessage, gintStyle, gstrTitle)
MousePointer = vbDefault
Unload Me
Exit Sub
Else
' put info from database into variables
gstrNumber = !fldNumber
' put info from variables into text boxes on main form
With frmFields
.mskPhone.Container = gstrNumber
End With
End If
End With
As soon as it hits the END WITH it drops the data and continues to load everything to the new form except for the phone number from this recordset.
Any help would be HUGELY appreciated.
Thanks guys!
Shawn

