+ Post New Thread
Results 1 to 5 of 5
Scripts Thread, small vbs help please in Coding and Web Development; Code: Set objAccess = CreateObject("Access.Application") objAccess.OpenCurrentDatabase "C:\Inetpub\wwwroot\s4\fpdb\s4.mdb" Set objCommand = objAccess.DoCmd objCommand.OpenReport "Boarding_Summary" objAccess.CloseCurrentDatabase How do I add a message ...
  1. #1

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,512
    Thank Post
    1,320
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199

    small vbs help please

    Code:
    Set objAccess = CreateObject("Access.Application")
    objAccess.OpenCurrentDatabase "C:\Inetpub\wwwroot\s4\fpdb\s4.mdb"
    
    Set objCommand = objAccess.DoCmd
    
    objCommand.OpenReport "Boarding_Summary"
    
    objAccess.CloseCurrentDatabase
    How do I add a message box at the end of that script that just says "printed ok" or something with an OK button.

    i had this
    Code:
    MsgBox("School Reports",65,"Reports sent to the printer...")
    but get an error about parenthesis.

    Any clues please?

    Cheers.

  2. #2

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,400
    Thank Post
    636
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    319
    Try any of these:

    Code:
    MsgBox "School Reports",65,"Reports sent to the printer..."
    or

    Code:
    Call MsgBox("School Reports",65,"Reports sent to the printer...")

  3. Thanks to webman from:

    RabbieBurns (20th May 2008)

  4. #3

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,512
    Thank Post
    1,320
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199
    cheers thats the one..

    note to self: error about parenthesis? why not remove them and try again before posting.

  5. #4

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123
    Quote Originally Posted by rreynolds24 View Post
    cheers thats the one..

    note to self: error about parenthesis? why not remove them and try again before posting.
    Always easy after the event :-)

    One of the things which really annoyed me when I started using BBC Basic was that it was much more fussy about closing quotes - other BASICs would cope with:

    Print "Hello World
    but BBC Basic gave a missing " error - I always wanted to scream at it "well, if you know it's missing, why can't you put it in?" - the same applies here. If it knows that there shouldn't be parentheses then why can't it take them out!

  6. #5
    altecsole's Avatar
    Join Date
    Jun 2005
    Location
    Morecambe, Lancashire, UK.
    Posts
    281
    Thank Post
    39
    Thanked 36 Times in 26 Posts
    Rep Power
    25
    Quote Originally Posted by rreynolds24 View Post
    cheers thats the one..

    note to self: error about parenthesis? why not remove them and try again before posting.
    MsgBox can use parenthesis. In that case you're calling a function which returns a value to indicate which button was clicked (you may have OK and Cancel for instance). So:

    buttonClicked = MsgBox("School Reports",65,"Reports sent to the printer...")

    would work and the value of buttonClicked value would tell you whether OK or Cancel was clicked (1 would be OK, 2 would be Cancel)

    Using MsgBox without parenthesis calls a Sub, which doesn't return a value.

SHARE:
+ Post New Thread

Similar Threads

  1. Small All-In-One Laser
    By button_ripple in forum Hardware
    Replies: 2
    Last Post: 6th April 2008, 08:13 PM
  2. 1 Small Question
    By ratkin980 in forum Network and Classroom Management
    Replies: 10
    Last Post: 25th January 2008, 10:55 PM
  3. Check This - Just how small is small?
    By Lithium in forum Mac
    Replies: 17
    Last Post: 16th January 2008, 09:56 AM
  4. Now that's small!
    By Ric_ in forum General Chat
    Replies: 1
    Last Post: 23rd April 2007, 05:12 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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