Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MsgBox question (Access 2000)

    What is the MsgBox construction to enter the number of the invoice and after that to open the report exactly at the same invoice? The question to be asked is" Please enter the number of the invoice"

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

    Re: MsgBox question (Access 2000)

    You don't use a msgbox for that, you use an inputbox, which can return a value. So you would use something like this:

    <code>Dim varInvoiceNumber as Variant
    varInvoiceNumber = InputBox("Enter the Invoice Number")
    If IsNumeric(varInvoiceNumber) Then
    ' This is where you open the report
    End If</code>
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MsgBox question (Access 2000)

    Or you could put [Enter Invoice Number] in the criteria box of a query behind the report, and do away with the code.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

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

    Re: MsgBox question (Access 2000)

    That doesn't work as expected if you are trying to launch the report from code, Jeremy. You won't get a criteria input dialog, but you will get a "parameter missing" error.
    Charlotte

  5. #5
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MsgBox question (Access 2000)

    Good to know, thanks Charlotte!
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  6. #6
    New Lounger
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MsgBox question (Access 2000)

    Thank you so much for you helpful answer

  7. #7
    New Lounger
    Join Date
    Oct 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MsgBox question (Access 2000)

    Do i need some refinement in my code when the report is in a tabular format? For example, when i type 9481,the report opens together with other invoices,and does not show only invoice number 9481.
    Thank you

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

    Re: MsgBox question (Access 2000)

    Where Charlotte had
    <code>
    ' This is where you open the report
    </code>
    you must have something like
    <code>
    DoCmd.OpenReport "rptMyReport", acViewPreview, ,"[InvoiceNo] = " & varInvoiceNumber
    </code>
    where rptMyReport is the name of the report, and InvoiceNo is the name of the invoice number field.

Posting Permissions

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