If a user logs in the login form and they are a new employee, I want the employeeinfoform to open in data entry mode. If the user logs in and they are a current employee, I want the employeeinfoform to pull up their informaton from the employeeinfoquery. I'm getting a "too few parameters. Need one" error message at the following code:
Set rs = CurrentDb.OpenRecordset(StrSQL)
What am I missing?
Private Sub Command4_Click()
Dim StrSQL As String
Dim QDF As QueryDef
Dim rs As Recordset
StrSQL = "SELECT * from EmployeeInfoTbl WHERE EmployeeInfoTbl.Employee = Forms!LoginForm!employee"
Set QDF = CurrentDb.QueryDefs("EmployeeInfoQuery")
QDF.SQL = StrSQL
QDF.Close
Set rs = CurrentDb.OpenRecordset(StrSQL)
If rs.BOF And rs.EOF Then
DoCmd.OpenForm "EmployeeInfoForm"
Forms!EmployeeInfoForm.DataEntry = True
Else
DoCmd.OpenForm "EmployeeInfoForm"
Forms!EmployeeInfoForm.DataEntry = False
End If
End Sub

Set rs = CurrentDb.OpenRecordset(StrSQL)
What am I missing?
Private Sub Command4_Click()
Dim StrSQL As String
Dim QDF As QueryDef
Dim rs As Recordset
StrSQL = "SELECT * from EmployeeInfoTbl WHERE EmployeeInfoTbl.Employee = Forms!LoginForm!employee"
Set QDF = CurrentDb.QueryDefs("EmployeeInfoQuery")
QDF.SQL = StrSQL
QDF.Close
Set rs = CurrentDb.OpenRecordset(StrSQL)
If rs.BOF And rs.EOF Then
DoCmd.OpenForm "EmployeeInfoForm"
Forms!EmployeeInfoForm.DataEntry = True
Else
DoCmd.OpenForm "EmployeeInfoForm"
Forms!EmployeeInfoForm.DataEntry = False
End If
End Sub

Last edited: