Unanswered: How to add a code to login form to filter records?
I have a login form where sales reps put in their login name and password which opens a customers form. I want customers form to open with only a particular month's records for that sales rep.
What I want to do is
1) Open records for the sales rep who is loging in. (This part works).
2) Open only the records where RunMonth = #6/1/2004# when the customers form opens. (This is what I'm trying to add to the code).
(RunMonth is a text field on the form, its control source is RunMonth from the customers table which is the customers form's control source).
How do I add a filter to the code I have below to make it work?
Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim conDB As ADODB.Connection
Dim rstblReps As ADODB.Recordset
Dim strPassword As String
Set conDB = New ADODB.Connection
conDB.Provider = "Microsoft.Jet.OLEDB.4.0"
conDB.Open "\\Backup\Departments\Mrkt\Telemarketing_Database\ CustomerCallServiceTracking.mdb", "Admin", ""
Set rstblReps = New ADODB.Recordset
rstblReps.Open "select Password from tblReps where [Rep#]=" & Me![Combo4], conDB
strPassword = Trim(rstblReps!Password & "")
Set rstblReps = Nothing
Set conDB = Nothing
If strPassword = Trim(Text5.Value & "") Then