Results 1 to 3 of 3
  1. #1
    animaimmortale is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    4

    Message Box based on Query Value

    I have a query, TonerAudit, that audits toner inventory based on the [number of cartridges in inventory] - [cartridges installed in labs]. Data is grouped by the cartridge reorder number.

    When the db opens I would like the switchboard form to run an On Open event that evaluates if [TonerAudit].[Expr1] < 2 and if so return a message box saying that toner needs to be reordered.

    I tried doing this using a macro but I ran into the problem that my if/then procedure will not access individual columns in TonerAudit.

    I was wondering if there is a way to do this with VBScript.



    Thanks in advance!

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by animaimmortale View Post
    I have a query, TonerAudit, that audits toner inventory based on the [number of cartridges in inventory] - [cartridges installed in labs]. Data is grouped by the cartridge reorder number.

    When the db opens I would like the switchboard form to run an On Open event that evaluates if [TonerAudit].[Expr1] < 2 and if so return a message box saying that toner needs to be reordered.

    I tried doing this using a macro but I ran into the problem that my if/then procedure will not access individual columns in TonerAudit.

    I was wondering if there is a way to do this with VBScript.

    Thanks in advance!
    Put the in the on load event of the switchboard:

    Dim X as Integer
    X = DLookUp(["Expr1","TonerAudit")
    If X < 2 Then
    Msgbox "You need to re-order toners",vbInformation,"Order Toner"
    End if

  3. #3
    animaimmortale is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    4
    This eventually worked for me but gave a syntax error at first.

    Dim X as Integer
    X=DLookup("CartridgeName","TonerAudit",Expr1<2)
    Msgbox "Toner cartridge " & X & " is low on inventory!"

    Thanks for putting me on the right track!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. ODBC timeout message on query
    By thart21 in forum Queries
    Replies: 3
    Last Post: 08-05-2011, 08:54 AM
  2. Replies: 1
    Last Post: 07-25-2011, 09:10 AM
  3. Message popup based on USERNAME
    By jpkeller55 in forum Access
    Replies: 3
    Last Post: 12-19-2010, 09:51 PM
  4. Replies: 11
    Last Post: 11-26-2010, 10:53 PM
  5. Replies: 1
    Last Post: 07-30-2010, 10:28 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums