G
Guest
I am using the followiing in the OnOpen Event of a form designated as the
Startup form when the database opens. The record source for the form is a
simple table with a field named user and a field named form. Me.txtUser has
a default value pulling the user name from an environment variable.
Problem is trying to get DoCmd.OpenForm [Forms]![Startup].[txtForm],
acNormal to work. txtForm is the field form in the record source. I want
the form named in this field to open and evidently my syntax is wrong.
Dim USER As DAO.Recordset
Set USER = Me.RecordsetClone
USER.FindFirst "[User] = '" & Me.txtUSER & "'"
If USER.NoMatch Then
MsgBox "No Match", vbOKOnly
DoCmd.OpenForm "Green", acNormal
Else
MsgBox "Match"
DoCmd.OpenForm [Forms]![Startup].[txtForm], acNormal
End If
Can anyone resolve this? Thank you.
Startup form when the database opens. The record source for the form is a
simple table with a field named user and a field named form. Me.txtUser has
a default value pulling the user name from an environment variable.
Problem is trying to get DoCmd.OpenForm [Forms]![Startup].[txtForm],
acNormal to work. txtForm is the field form in the record source. I want
the form named in this field to open and evidently my syntax is wrong.
Dim USER As DAO.Recordset
Set USER = Me.RecordsetClone
USER.FindFirst "[User] = '" & Me.txtUSER & "'"
If USER.NoMatch Then
MsgBox "No Match", vbOKOnly
DoCmd.OpenForm "Green", acNormal
Else
MsgBox "Match"
DoCmd.OpenForm [Forms]![Startup].[txtForm], acNormal
End If
Can anyone resolve this? Thank you.