Find by Lastname does not work, until we click by Firstname, then

F

Frank Situmorang

Hello,

I have a problem in my Find Form that when I chose by Last name, it won't
work, I have to go to option 2 by Fist name, then to by Last name then it
works.

Can anyone help me how to solve this problem?

This is my VBA:
Private Sub optChoose_AfterUpdate()
' Populate rowsource of cboSelect

Dim strSQL As String

On Error GoTo HandleErr

Select Case optChoose
Case 1
' NamaAkhir/Marga
strSQL = "Select Distinct LName from BukuAngKbyQuery " _
& "Order By LName"
Case 2
' Nama Awal
strSQL = "Select Distinct FName from BukuAngKbyQuery " _
& "Where FName Is Not Null Order By FName"
Case 3
' Nama Tengah
strSQL = "Select Distinct MName from BukuAngKbyQuery " _
& "Where MName Is Not Null Order By MName"
Case 4
' nickname/julukan
strSQL = "Select Distinct NickName from BukuAngKbyQuery " _
& "Where NickName Is Not Null Order By NickName"
Case Else
End Select

With Me!cboSelect
.Value = Null
.RowSource = strSQL
.Requery
.Value = .ItemData(0)
End With

ExitHere:
Exit Sub

HandleErr:
Select Case Err
Case Else
MsgBox Err & ": " & Err.Description, vbCritical, _
"Error in Form_FindForm.optChoose_AfterUpdate"
End Select
Resume ExitHere
Resume
End Sub
 
A

AccessVandal via AccessMonster.com

Hi Frank,

Is this control an option group or a individual option button?

My guess is that you had the control "optChoose" option group control where
the "Default Value" was set to "1". Try setting it to "0".

Whenever the default is set to "1", you have click on the next option in
order for the event to fire up.
 
Top