Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    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
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •