Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Openform Command (Acc2003 on xp (2000 mode))

    The OpenForm command in line 4 is causing me grief. I either get a parameter box asking for a value or the form open to a blank record.
    I'm sure its just a case of correct syntax in the command, so could someone correct it for me?

    The field AccNo is a text field, not numeric

    1 ChTo.Value = Val(DMax("AccNo", "Customer", "[AccNo]<'999999'")) + 1
    2 CName = ChTo.Value
    3 Call ChangeCode
    4 DoCmd.OpenForm "editcustname", , , "AccNo = CName"
    5 DoCmd.Close acForm, "frmChangeCode"

    Many thanks in advance,

    Regards Allan
    "Heading for the deep end"

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Openform Command (Acc2003 on xp (2000 mode))

    DoCmd.OpenForm "editcustname", , , "AccNo = " & Chr(34) & CName & Chr(34)

    The way you had it written, it would have been looking for the literal value CName instead of the value stored in it. Since AcctNo is a string, I added the double quote around the value using Chr(34). If ChangeCode already returns a string wrapped in extra double quote, you don't need those in the OpenForm statement.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Openform Command (Acc2003 on xp (2000 mode))

    Thankyou Charlotte,
    it worked just as you had it. I did work out that it was searching for the literal value and I was SURE it was just a case of getting the syntax right.

    Regards Allan
    "Heading for the deep end"

Posting Permissions

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