Results 1 to 4 of 4
  1. #1
    DC CS is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Jan 2023
    Location
    Vaalpark, South Africa
    Posts
    69

    Running VB Script

    Hi all,


    I have a VB Script running once a week to generate a report of incomplete processing in my Access database. The script code as follows:

    Code:
    Set accessApp = CreateObject("Access.Application")accessApp.OpenCurrentDataBase "C:\Users\AppData\StudentAdmin\Student Admin.accdb", false
    accessApp.visible = true
    accessApp.UserControl = true
    accessApp.DoCmd.RunMacro "Macro1"
    accessapp.quit
    The issue is that the script runs fine, but it stops at the login screen and I need to enter the cridentilas before the rest of the script is executed, with the resukt that it neverruns as the cridentials are not entered.

    Is there a way to bypass the login username and password to execute the Macro1 only?

    I am new at VB scripts and found the above code sample for the VB script on Microsoft's web site.

    Thanks

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Could you not create a simple Autorun database that produced the report only then closed down?
    If it's on a server that's on 24/7 then no-one else is likely to get to it?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Not clear but I suspect the login is in the called db. If you can use a desktop shortcut to launch the called db you can pass a command line switch contained in the shortcut to the Cmd function written in code in the called db. That function will return the switch if it exists. If it exists, then code your called db so that it bypasses the login part. As long as a regular user cannot access the shortcut they will have to log in.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    DC CS is offline Advanced Beginner
    Windows 11 Office 365
    Join Date
    Jan 2023
    Location
    Vaalpark, South Africa
    Posts
    69
    Hi all. Sorry for the delay. The Autorun db did the trick.
    Thanks

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

Similar Threads

  1. Script out of range
    By Ianw in forum Access
    Replies: 6
    Last Post: 02-18-2015, 10:11 PM
  2. Replies: 1
    Last Post: 08-21-2014, 04:26 PM
  3. Replies: 3
    Last Post: 02-04-2014, 09:50 AM
  4. New Line in VBA Script
    By tylerg11 in forum Forms
    Replies: 8
    Last Post: 01-04-2012, 02:01 PM
  5. Database script
    By kleclark in forum Programming
    Replies: 2
    Last Post: 02-15-2011, 11:50 AM

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