Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OpenForm Syntax (2007)

    I am trying to open a form in read only mode using the following code:

    DoCmd.OpenForm "frmAddPo", acNormal, ,[where confition] , acFormReadOnly

    This code is ran from frmMain when a button is pressed. But I want to add a where condition of when the field PO# in my query equals the PO# selected in the combo box on frmMain. I have tried many ways with no luck. Can someone please help my with the syntax if it is possible?

    thanks,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: OpenForm Syntax (2007)

    In the following, cmbPO is the name of the comno box; replace it with the name of the combo box on your form.

    If PO# is a number field:
    <code>
    DoCmd.OpenForm "frmAddPo", , ,"[PO#]=" & Me.[cmbPO], acFormReadOnly
    </code>
    If it is a text field:
    <code>
    DoCmd.OpenForm "frmAddPo", , ,"[PO#]=" & Chr(34) & Me.[cmbPO] & Chr(34), acFormReadOnly
    </code>
    (I have omitted acNormal since it is the default value for the View argument)

  3. #3
    2 Star Lounger
    Join Date
    Apr 2002
    Location
    Evansville, Indiana, USA
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OpenForm Syntax (2007)

    It is a number so I used the first version and it works like I need it to.

    Thanks,

Posting Permissions

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