TempVars question

M

M Skabialka

I downloaded a Microsoft template for Project management and found some code
I do not understand. The form load is called from another form with this
line:
DoCmd.OpenForm "Project Details", acNormal, "", "[ID]=" & ID, , acDialog

The code was converted from the On Load macro.

If (Not IsNull(OpenArgs)) Then
DoCmd.GoToRecord , "", acNewRec
End If
If (Not CurrentProject.IsTrusted) Then
Exit Sub
End If
TempVars.Add "NewData",
"Mid(Nz([OpenArgs]),InStr(Nz([OpenArgs]),""="")+1)"
On Error Resume Next
If (TempVars!NewData <> "") Then
[Project Name] = TempVars!NewData
End If
TempVars.Remove "NewData"

This code takes whatever the name of the Project is, and replaces it with
Mid(Nz([OpenArgs]),InStr(Nz([OpenArgs]),"=")+1)

This of course corrupts the actual project name.
Can anyone tell what may have been lost in the translation from Macro to VBA
code so I can make this work properly?
Mich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top