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
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