Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using option group w/vb code to filter lname, turns data into numbers?

Status
Not open for further replies.

CHPD

IS-IT--Management
Jul 23, 2004
5
0
0
US
The form I've build contains an option group with vb code to filter through the last name records for end user ease. The code to filter works, however when searching and viewing the data the last name field on some of my data changes to numerics.

See code below:

Private Sub alphabar_AfterUpdate()
On Error GoTo alphabar_AfterUpdate_Err

If (alphabar = 1) Then
' Filter last names that start with A.
DoCmd.ApplyFilter "", "[tblTest]![strLastName] Like ""A*"""
End If



If (RecordsetClone.RecordCount > 0) Then
' If records are returned for the selected letter, go to the AlphaBar control.
DoCmd.GoToControl "alphabar"
' Stop the macro.
Exit Sub
End If



alphabar_AfterUpdate_Exit:
Exit Sub

alphabar_AfterUpdate_Err:
MsgBox Error$
Resume alphabar_AfterUpdate_Exit

End Sub

Please Help!

 
My guess is you bound the control to the field that is changing to numeric.
 
I removed the option group and replaced with the following code:

If DCount("strLastName", "tbltest", "strLastName like 'C*'") > 0 Then
Me.Filter = "strLastName like 'C*'"
Me.FilterOn = True
Else
MsgBox "No records exist"
End If
End Sub

The code works beautiful for me! Kiss my Brain!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top