I've Blown It And Need Advice Please

JediYodaNT

Registered User.
Local time
Yesterday, 19:47
Joined
May 8, 2009
Messages
26
So, I'm brand new to Access and hav been going through training myself via Trial By Fire. We have a department database was build and maintained by an associate who has since left the company. I found that one of the primary tables had set the InputDate field to a text format instead of a date/time format. I just made the needed adjustment so taht other reports would function correctly, however in the process, I broke one of the other search forms. Would anyone mind looking at the code and seeing if you spot what I might need to fix? Any help would be wonderful. The text in red is what the debugger is highlighting.


Private Sub Command10_Click()
DoCmd.Close
DoCmd.OpenForm "search", acNormal, , , acFormAdd, acWindowNormal

End Sub
Private Sub Command13_Click()
DoCmd.Close
DoCmd.OpenForm "switchboard", acNormal, , , acFormAdd, acWindowNormal

End Sub
Private Sub Search_Click()
Dim strWhere As String
Dim strError As String

strWhere = "1=1"

' If BAI Rep
If Not IsNull(Me.OpsRep) Then
'Create Predicate
strWhere = strWhere & " AND " & "input.[opsrep] = '" & Me.OpsRep & "'"
End If

' If Account Number
If Not IsNull(Me.acctno) Then
'Add the predicate
strWhere = strWhere & " AND " & "input.[account#] = '" & Me.acctno & "'"
End If

' If Date
If Not IsNull(Me.InputDate) Then
' Add it to the predicate - exact
strWhere = strWhere & " AND " & "input.[inputdate]= '" & Me.InputDate & "'"
End If
' If Process
If Nz(Me.Process) <> "" Then
'Add it to the predicate - exact match
strWhere = strWhere & " AND " & "input.[process]= '" & Me.Process & "'"
End If

If strError <> "" Then
MsgBox strError
Else
'DoCmd.OpenForm "Browse Issues", acFormDS, , strWhere, acFormEdit, acWindowNormal
If Not Me.FormFooter.Visible Then
Me.FormFooter.Visible = True
DoCmd.MoveSize Height:=Me.WindowHeight + Me.FormFooter.Height
End If
Me.browse_all_docs.Form.Filter = strWhere
Me.browse_all_docs.Form.FilterOn = True

End If
End Sub
 
Are you getting an error message? If so, what does it say?
 
If it's a date/time field now this would have to change:

strWhere = strWhere & " AND " & "input.[inputdate]= '" & Me.InputDate & "'"

to this

strWhere = strWhere & " AND " & "input.[inputdate]= #" & Me.InputDate & "#"
 
Spot On pbaldy! Just gave it a trial run and I'm back up and running. Thanks for your expertise.
 

Users who are viewing this thread

Back
Top Bottom