B
Baby Face Lee
Hi guys,
Hope you can help me.
I have a listbox that lists two fields from within a table. The first field
(CentreNo) is the bound column.
I'd like the users to be able to 'jump' to a particular CentreNo by
inputting the number in a separate textbox. This is the code in the command
button that is supposed to 'jump' to the required record:
Private Sub cmdJump_Click()
'jump to a selected Centre No
If IsNull([txtJump]) Then
MsgBox "Please enter a Centre No in the box.", vbExclamation, "Oops!"
ElseIf tCount("[CentreNo]", "qry_CentreNoName", "CentreNo=" & txtJump) <
1 Then
MsgBox "Sorry, centre not found.", vbInformation, "Try again"
txtJump = ""
DoCmd.GoToControl "txtJump"
Exit Sub
ElseIf tCount("[CentreNo]", "qry_CentreNoName", "CentreNo=" & txtJump) >
0 Then
DoCmd.GoToControl "lstCentres"
DoCmd.FindRecord txtJump, acEntire, False, acSearchAll, True,
acCurrent, True
End If
End Sub
I can't see why this doesn't work. Can you help?
Thanks in advance,
Lee
Hope you can help me.
I have a listbox that lists two fields from within a table. The first field
(CentreNo) is the bound column.
I'd like the users to be able to 'jump' to a particular CentreNo by
inputting the number in a separate textbox. This is the code in the command
button that is supposed to 'jump' to the required record:
Private Sub cmdJump_Click()
'jump to a selected Centre No
If IsNull([txtJump]) Then
MsgBox "Please enter a Centre No in the box.", vbExclamation, "Oops!"
ElseIf tCount("[CentreNo]", "qry_CentreNoName", "CentreNo=" & txtJump) <
1 Then
MsgBox "Sorry, centre not found.", vbInformation, "Try again"
txtJump = ""
DoCmd.GoToControl "txtJump"
Exit Sub
ElseIf tCount("[CentreNo]", "qry_CentreNoName", "CentreNo=" & txtJump) >
0 Then
DoCmd.GoToControl "lstCentres"
DoCmd.FindRecord txtJump, acEntire, False, acSearchAll, True,
acCurrent, True
End If
End Sub
I can't see why this doesn't work. Can you help?
Thanks in advance,
Lee