Results 1 to 2 of 2
2008-04-08, 07:15 #1
- Join Date
- Jan 2001
- Thanked 0 Times in 0 Posts
Showing records on a form (access 2003)
I'm using the code below to open a form called WS detail. It works well but I want the detail to be for the field I click on WSID. The WSID field is listed in the for WSDetail that opens. So when you click on the for the WS detail will show for only that WSID. I think you can add WSID somewhere in the code below bt I wan not sure. Thanks for the help...
Private Sub WSID_Click()
DoCmd.OpenForm "WsDetail", acNormal, "", "", , acNormal
2008-04-08, 09:17 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 Posts
Re: Showing records on a form (access 2003)
You can click in the word OpenForm and press F1 to get help on this method. You want the WhereCondition argument. If WSID is a number field, you can use
DoCmd.OpenForm "WsDetail", , , "WSID=" & Me.WSID
and if it is a text field, use
DoCmd.OpenForm "WsDetail", , , "WSID=" & Chr(34) & Me.WSID & Chr(34)
Chr(34) is the double quote character ".
Note: I'd use the On Dbl Click event of the WSID control instead of the On Click event, otherwise the form will pop each time the user clicks in the text box.