Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


feedback for my first vbscript

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,46193
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> feedback for my first vbscript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 feedback for my first vbscript - 4/21/2007 10:47:47 PM   
  vistree

 

Posts: 2
Score: 0
Joined: 4/21/2007
Status: offline
Hi forum,
absolutly new to vbscript I completed my first script by search through the forum and using copy and paste.
Now, as i need a error-free version I would like to ask for comments on the script. Is it OK or is there any problematic code inside. Works find for me now, but hope to complete it as stable with your help.
What I want to do? I want to open a filtered MS Access form through an other application. The parameter for the filter is send to a vbs from the origin programm:
cscript.exe myfirstvbs.vbs "parameter_as_string"
The content of myfirstvbs.vbs is:
quote:


Office_access_Bericht_Anzeigen ' Start des Skripts

Sub Office_access_Bericht_Anzeigen()

Dim var_flst
var_flst = WScript.Arguments(0)

Dim a ' As Access.Application

Dim MyObject
Dim thestring
Set MyObject = GetObject("G:\my_database.mdb")
If MyObject is Nothing Then
  MsgBox "my object is nothing"
Else
Set a = MyObject.Application
a.automationsecurity=1 ' low
'Anzeigen
If a.Visible = False Then a.Visible = True
'Formular anzeigen
thestring = var_flst
a.DoCmd.OpenForm "myformname", acNormal, , ("[ID_field]=" & Chr(34) & thestring & Chr(34))
'maximize
a.DoCmd.Maximize
End If
End Sub


What if I want to open the database exclusive? Whre to put the parameter?
Any comments?

Best regards
vistree
 
 
Post #: 1
 
 RE: feedback for my first vbscript - 4/22/2007 4:09:37 AM  1 votes
  ehvbs

 

Posts: 2223
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi vistree,

this should be error free:


      

but I doubt, that using GetObject() will allow you to open the database
exclusive. You should look into starting Access from a commandline instead.

Good luck

ehvbs

< Message edited by ehvbs -- 4/22/2007 4:10:40 AM >

(in reply to vistree)
 
 
Post #: 2
 
 RE: feedback for my first vbscript - 4/22/2007 1:13:34 PM   
  vistree

 

Posts: 2
Score: 0
Joined: 4/21/2007
Status: offline
That's great! Thank you ehvbs!

(in reply to ehvbs)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> feedback for my first vbscript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts