I tried to show the Activity Name auto when I select the Category Name(Party,Conference, other...) from my combo box and this part works good. However, after selecting the Category name, I would like it auto point the next place where to enter the data. I use GoToControl function but it didn't work. I really don't know what is wrong with my code, please help!!!
Below is the code I use:
-----------------------------------------------
Private Sub ActivityDetailID_AfterUpdate()
On Error GoTo ActivityDetailID_AfterUpdate_Err
Forms!Activity!ActivityName = DLookup("[ActivityName]", "ActivityDetail", "[ActivityDetailID] = " & Forms!Activity!ActivityDetailID)
If (ActivityDetailID = "Party") Then
DoCmd.GoToControl "PartyType"
End If
If (ActivityDetailID = "Conference") Then
DoCmd.GoToControl "ConferenceDate"
End If
If (ActivityDetailID = "Others") Then
DoCmd.GoToControl "Momo"
End If
ActivityDetailID_AfterUpdate_Exit:
Exit Sub
---------------------------------------------------------
Thanks,
byfr
Below is the code I use:
-----------------------------------------------
Private Sub ActivityDetailID_AfterUpdate()
On Error GoTo ActivityDetailID_AfterUpdate_Err
Forms!Activity!ActivityName = DLookup("[ActivityName]", "ActivityDetail", "[ActivityDetailID] = " & Forms!Activity!ActivityDetailID)
If (ActivityDetailID = "Party") Then
DoCmd.GoToControl "PartyType"
End If
If (ActivityDetailID = "Conference") Then
DoCmd.GoToControl "ConferenceDate"
End If
If (ActivityDetailID = "Others") Then
DoCmd.GoToControl "Momo"
End If
ActivityDetailID_AfterUpdate_Exit:
Exit Sub
---------------------------------------------------------
Thanks,
byfr