*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
"Peter Weinberger" <peter.we...@comverse.com> wrote in message
news:O3RJOPxBCHA.2572@tkmsftngp05...
Have you tried finding a working in-Access example? If you have a working
database to start with, one of the Access groups could probably help you put
together a reasonable facsimile which can then be turned into script.
"Peter Weinberger" <peter.we...@comverse.com> wrote in message
news:#RLpxvsCCHA.1560@tkmsftngp02...
<SCRIPT language=VBS event=onclick for=Command11>
<!--
Function maskmacro()
On Error GoTo maskmacro_Err
DoCmd.OpenQuery "qrymask", acNormal, acAdd
DoCmd.OpenQuery "qrydelmask", acNormal, acEdit
maskmacro_Exit:
Exit Function
maskmacro_Err:
MsgBox Error$
Resume maskmacro_Exit
End Function
-->
</SCRIPT>
[This is how Access automatically creates code in jscript that
manipulates the database:]
<SCRIPT language=javascript event=onclick for=Command9>
try { MSODSC.CurrentSection.DataPage.Save(); }
[MSODSC.somethingelse.method/function to trigger
query???????????????????????????????????????????????????????????????????
]
catch (e)
{ alert (e.description);}
</SCRIPT>
Here's a minor modification of your first function as a "pure" VBScript; it can
be saved and run interactively as mask.vbs. It is not exactly what you want,
I'm sure, but the key thing is getting you to know the differences in VBScript;
in many ways it is easier than VB or VBA, once you know its idiosyncrasies.
Very simple error control: you can toggle off breaking on errors with "On Error
Resume Next", and turn it back on with "On Error Goto 0". You can't branch on
errors, unfortunately.
You have to instantiate something you are going to use. This is probably a moot
point; you have an object ref to Access or something in your page; for a
client-side script example,we have to instantiate it below. If your object's ID
is "Acc", the code should look an awful lot like this.
On Error Resume Next
Set Acc = GetObject("C:\temp\scripting.mdb")
Acc.Visible = True
Const acAdd = 0, acEdit = 1, acNormal = 0
Acc.DoCmd.OpenQuery "qrymask", acNormal, acAdd
Acc.DoCmd.OpenQuery "qrydelmask", acNormal, acEdit
Acc.UserControl = True
MsgBox Err.Number & Err.Source & Err.Description
Err.Clear
"Peter Weinberger" <peter.we...@comverse.com> wrote in message
news:Oys3Dx7CCHA.2072@tkmsftngp02...