Need Syntax help to change Startup Form programmatically

  • Thread starter Thread starter Jim Evans
  • Start date Start date
J

Jim Evans

I am trying to set a new startup form if certain set of conditions exist.
VBE Help says that I can do it but gives very little information on the
Syntax.

Would appreciate any and all help with this.

tia,

Jim Evans
 
Hi Jim,

Here is a past post of mine on this subject. It should help I believe:

1. Create a new standard module and copy/paste this code:

Public Function funcSetStartupForm( _
strForm As String)
On Error GoTo ErrorPoint

CurrentDb().Properties("StartupForm") = _
strForm

ExitPoint:
Exit Function

ErrorPoint:
If Err = 3270 Then
' Property was not found
Dim db As DAO.Database
Dim prop As DAO.Property
Set db = CurrentDb()
Set prop = db.CreateProperty("StartupForm", _
dbText, "(none)")
db.Properties.Append prop
Resume Next
End If

End Function

2. Make sure to set a reference to the DAO object library
if you are using Access 2000 or 2002 (97 or 2003 should
already be set).

3. Compile the code and save the module as
modSetStartUpForm

4. Somewhere in your code you simply call the function
like so:

funcSetStartupForm ("NameofTheFormHere")

Hope that helps,
 
Jeff,

Thank you, very, very much.

I used most of the afternoon trying to figure this out. You have made it so
simple and flexible.

Thanks, again
Jim Evans
 
Back
Top