Open form from double click on field

RexesOperator

Registered User.
Local time
Today, 11:08
Joined
Jul 15, 2006
Messages
604
I have a form frmTowerLog with a text box called txtFILENUMBER. When I double click on it this code fires (thanks to Paul's site):

Private Sub txtFILENUMBER_DblClick(Cancel As Integer)
DoCmd.OpenForm "frmTransactionsMain", , , "txtFILENUMBER = '" & Me.txtFILENUMBER & "'"
End Sub

However it brings up a parameter query asking for the File Number. How can I go directily to the frmTransactionsMain without being asked for the file number?
 
You need to feed it the FIELD not the text box:

Code:
DoCmd.OpenForm "frmTransactionsMain", , , "[FILENUMBER] = '" & Me.txtFILENUMBER & "'"

And if FileNumber isn't your field name in the form that is opening, replace it with the real field name. Also, if it isn't text then use this instead:

Code:
DoCmd.OpenForm "frmTransactionsMain", , , "[FILENUMBER] =" & Me.txtFILENUMBER
 
Thanks again Bob - works perfectly!
 

Users who are viewing this thread

Back
Top Bottom