The strFilter results in the following, but will not carry through to the Me.Filter, any ideas why?
strFilter = "'20410' OR 'A20000' OR 'A20400'"
Private Sub Image_OffsetFilterButton_Click()
Dim strFilter As String
strFilter = "'A20410'"
'/ see if there is data in Field Box Text907, if so add it to the filter
If Me!Text907 & vbNullStr <> vbNullStr Then
strFilter = strFilter & " OR " & "'" & "A20000" & "'"
End If
If Me!Text910 & vbNullStr <> vbNullStr Then
' If FieldB is of Text type, use the ' delimiter
strFilter = strFilter & " OR " & "'" & "A20024" & "'"
End If
If Me!Text911 & vbNullStr <> vbNullStr Then
' If FieldB is of Text type, use the ' delimiter
strFilter = strFilter & " OR " & "'" & "A20400" & "'"
End If
'/<etc>
If strFilter <> "" Then
' trim off leading "OR"
Me.Filter = "[Account] = strFilter AND [BU] = 'B50931'"
Me.FilterOn = True
Else
Me.Filter = ""
Me.FilterOn = False
End If
End Sub
Private Sub Image_OffsetFilterButton_Click()
Dim strFilter As String
strFilter = ""
'/ see if there is data in Field Box Text907, if so add it to the filter
If Me!Text907 & vbNullStr <> vbNullStr Then
strFilter = strFilter & " OR [ACCOUNT] = '" & Me.Text907 & "'"
End If
If Me!Text910 & vbNullStr <> vbNullStr Then
'/ If FieldB is of Text type, use the ' delimiter
strFilter = strFilter & " OR [ACCOUNT] = '" & Me.Text910 & "'"
End If
If Me!Text911 & vbNullStr <> vbNullStr Then
'/ If FieldB is of Text type, use the ' delimiter
strFilter = strFilter & " OR [ACCOUNT] = '" & Me.Text911 & "'"
End If
'/<etc>
If strFilter <> "" Then
'\ trim off leading "OR"
Me.Filter = Mid(strFilter, 4)
Me.FilterOn = True
Else
Me.Filter = "[BU] = [Forms]![Frm_Main]! [Frm_Main_TextBox_Display_BU_Number_HIDDEN].Value"
Me.FilterOn = False
End If
End Sub
Related
I have been working on a project as a volunteer crime analyst, and I have run into issues on how to enter in multiple text boxes, a multi-valued combo box and how to make sure that if there are no entries made that those boxes are ignored in favor of those that have values in them. I have figured out how to have multiple multi-select list boxes return data from a data entry table, what I'm asking is for help on how to add in the rest of the components that are on the MS Access form that I have for a prototype database.
Here is my code, would like to have some advice on how and where the code for the text boxes and multi-valued combo box would go
Private Sub Command62_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strCriteria1 As String
Dim strCriteria2 As String
Dim strCriteria3 As String
Dim strCriteria4 As String
Dim strCriteria5 As String
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("qryMultiselect")
For Each varItem In Me!District.ItemsSelected
strCriteria = strCriteria & ",'" & Me!District.ItemData(varItem) & "'"
Next varItem
If Len(strCriteria) = 0 Then
MsgBox "You did not select anything in the Contract field." _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria = Right(strCriteria, Len(strCriteria) - 1)
For Each varItem In Me!MOMethodofEntry.ItemsSelected
strCriteria1 = strCriteria1 & ",'" & Me!MOMethodofEntry.ItemData(varItem) &
"'"
Next varItem
If Len(strCriteria1) = 0 Then
MsgBox "You did not select anything in the Name field." _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria1 = Right(strCriteria1, Len(strCriteria1) - 1)
For Each varItem In Me!MOLocation.ItemsSelected
strCriteria2 = strCriteria2 & ",'" & Me!MOLocation.ItemData(varItem) & "'"
Next varItem
If Len(strCriteria2) = 0 Then
MsgBox "You did not select anything in the Name field." _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria2 = Right(strCriteria2, Len(strCriteria2) - 1)
For Each varItem In Me!MOPointofEntry.ItemsSelected
strCriteria3 = strCriteria3 & ",'" & Me!MOPointofEntry.ItemData(varItem) &
"'"
Next varItem
If Len(strCriteria3) = 0 Then
MsgBox "You did not select anything in the Name field." _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria3 = Right(strCriteria3, Len(strCriteria3) - 1)
For Each varItem In Me!CircumstanceCode.ItemsSelected
strCriteria4 = strCriteria4 & ",'" & Me!CircumstanceCode.ItemData(varItem) &
"'"
Next varItem
If Len(strCriteria4) = 0 Then
MsgBox "You did not select anything in the Name field." _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria4 = Right(strCriteria4, Len(strCriteria4) - 1)
For Each varItem In Me!MOWeapon.ItemsSelected
strCriteria5 = strCriteria5 & ",'" & Me!MOWeapon.ItemData(varItem) & "'"
Next varItem
If Len(strCriteria5) = 0 Then
MsgBox "You did not select anything in the Contract field." _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria5 = Right(strCriteria5, Len(strCriteria5) - 1)
strSQL = "SELECT * FROM tblDataEntry " & _
"WHERE tblDataEntry.District IN(" & strCriteria & ") AND
tblDataEntry.MOMethodofEntry IN(" & strCriteria1 & ") AND
tblDataEntry.MOLocation IN(" & strCriteria2 & ") AND
tblDataEntry.MOPointofEntry IN (" & strCriteria3 & ") AND
tblDataEntry.CircumstanceCode IN (" & strCriteria4 & ") AND
tblDataEntry.MOWeapon IN(" & strCriteria5 & ");"
qdf.SQL = strSQL
DoCmd.OpenQuery "qryMultiselect"
Set db = Nothing
Set qdf = Nothing
End Sub
Also please let me know if I am doing anything wrong. Still a little new to this.
I am not sure what do you mean with "where the code for the text boxes and multi-valued combo box would go" but I can help you with writing better code. Put inside of your form this functions:
Private Function GetSelectedItems(combo As ListBox) As String
Dim result As String
Dim n As Integer
With combo
For n = .ListCount - 1 To 0 Step -1
If .Selected(n) Then
result = result & ",'" & .ItemData(n) & "'"
End If
Next n
End With
GetSelectedItems = Mid(result, 2)
End Function
Public Function IsEmptyOrNull(strValue As Variant) As Boolean
If Trim(strValue) = vbNullString Or IsNull(strValue) Then
IsEmptyOrNull = True
End If
End Function
and than you call the function like this:
strCriteria = GetSelectedItems(Me!District)
strCriteria1 = GetSelectedItems(Me!MOMethodofEntry)
…
After you fill in all your criteria create strFilter string:
If Not IsEmptyOrNull(strCriteria) Then
strFilter = IIf(Not IsEmptyOrNull(strFilter), strFilter & " AND ", "") & " District IN (" & strCriteria & ")"
End If
If Not IsEmptyOrNull(strCriteria1) Then
strFilter = IIf(Not IsEmptyOrNull(strFilter), strFilter & " AND ", "") & " MOMethodofEntry IN (" & strCriteria1 & ")"
End If
…
Something similar do with your text boxes:
If Not IsEmptyOrNull(Me.txtCaseNumber) Then
strFilter = IIf(Not IsEmptyOrNull(strFilter), strFilter & " AND ", "") & " CaseNumber= '" & Me.txtCaseNumber & "'"
End If
and after you add all your fields create your strSQL string:
strSQL = "SELECT * FROM tblDataEntry WHERE " & strFilter
I have a question dealing with a filter function.
I am fine when using a button to search if there is any related data when I entered a keyword. And my code like,
Private Sub Command112_Click()
Dim strSearch As String
Dim strFilter As String
strSearch = "'*" & Forms![TestForm].SearchInput & "*'"
Debug.Print strSearch
strFilter = _
"[IMSDP] Like " & strSearch & _
" Or [EN8] Like " & strSearch & _
" Or [EN10] Like " & strSearch & _
" Or [Card] Like " & strSearch & _
" Or [Status] Like " & strSearch & _
" Or [IMSDP] Like " & strSearch
Debug.Print strFilter
Me.Filter = strFilter
Me.FilterOn = True
End Sub
But once I want to search more than one keyword, it doesn't work.
And my code like following,
Private Sub Search_Click()
Dim strSearch As Variant
Dim strFilter1 As Variant
Dim strFilter2 As Variant
Dim SpacePosition As Variant
Dim Lstr As Variant
Dim Rstr As Variant
Dim IMSDP1 As Variant
Dim IMSDP2 As Variant
strSearch = "'*" & Forms![tryForm].IMSDPInput & "*'"
Debug.Print strSearch
SpacePosition = InStr(1, [strSearch], " ")
Lstr = Trim(Left([strSearch], [SpacePosition] - 1))
Rstr = Trim(Right([strSearch], Len([strSearch]) - [SpacePosition]))
IMSDP1 = Lstr
IMSDP2 = Rstr
MsgBox "IMSDP1 is " & IMSDP1 & " and IMSDP2 is " & IMSDP2 & ""
strFilter1 = _
"[IMSDP] Like " & IMSDP1 & _
"And [IMSDP] Like " & IMSDP2
Me.Filter = strFilter
Me.FilterOn = True
End Sub
Can anyone help? Thank you.
I am now having the code like follow, (you may think Status = IMSDP)
Private Sub Command14_Click()
Dim Status_Filter As Variant
Dim Status_Input As Variant
Dim SpacePosition As Variant
Dim Status1 As Variant
Dim Status2 As Variant
Status_Input = "'*" & Forms![tryForm].StatusInput & "*'"
SpacePosition = InStr(1, [Status_Input], " ")
If (SpacePosition = 0) Then
Status_Filter = _
"[Status] Like " & Status_Input
Else
Status1 = Left([Status_Input], [SpacePosition] - 1)
Status2 = Right([Status_Input], Len([Status_Input]) - [SpacePosition])
MsgBox "Status1 is " & Status1 & " and Status2 is " & Status2 & ""
Status_Filter = _
"[Status] Like " & Status1 & _
"Or [Status] Like " & Status2
End If
Debug.Print Status_Filter
Me.Filter = Status_Filter
Me.FilterOn = True
End Sub
It works if I only enter one keyword(e.g. "20") to search but fail if I entering something like "20 27".
I only know I can write in Excel like, Range("A1").AutoFilter Field:=5, Criteria1:=Status1, Operator:=xlOr, Criteria2:=Status2 But I have no idea how to do it in Access
If Status field is number type and users always enter 'keywords' separated by a space, consider the following:
Private Sub Command14_Click()
If Not IsNull(Me.StatusInput) Then
Me.Filter = "IN(" & Replace(Me.StatusInput, " ", ",") & ")"
End If
Me.FilterOn = True
End Sub
If they enter separated with comma, even simpler:
Me.Filter = "IN(" Me.StatusInput & ")"
For a text field:
"IN('" & Replace(Me.StatusInput, " ", "','") & "')"
"IN('" & Replace(Me.StatusInput, ",", "','") & "')"
Regardless of code structure, depends on users entering string in textbox correctly and consistently.
If you want more control over the values user can enter, use a multi-select listbox and VBA loops through the listbox selected items to construct the comma separated values criteria. A fairly common topic and many code examples available for looping listbox.
And no array needed after all!
I'm writing VBA code for an application in Access for the first time and have created two separate strings to filter a report. The first of these strFilter filters the reports based on criteria in a list box. The second strWhere has been set up to filter the report based on a date input into a pair of text boxes. Both of these string filters work perfectly when used separately.
What I want to know is if there is a way to combine the two strings easily so that the user an filter the report based on both the criteria in the list box and the date they have entered in the text boxes.
The code I have for the listbox filter when it is added to the reports filter currently looks like this:
With Reports![rptFaultRecords]
.Filter = strFilter
.FilterOn = True
I want to add the string to filter by date strWhere next to the strFilter so the report can be filtered by both date and list criteria. All the code I've entered when attempting to do this has given me a run time error 3075. Is it possible for these two strings to be combined easily and if so how can I do it?
The rest of the code I've written is below if you need to see it:
Private Sub btnAllFaultsFilter_Click()
Dim varItem As Variant
Dim strRoom As String
Dim strFilter As String
Dim strDevice As String
Dim strCat As String
Dim strStatus As String
Dim strDateField As String
Dim strWhere As String
Const strcJetDate = "\#mm\/dd\/yyyy\#"
strDateField = "[f_datereported]"
If IsDate(Me.txtStartDate) Then
strWhere = "(" & strDateField & " >= " & Format(Me.txtStartDate, strcJetDate) & ")"
End If
If IsDate(Me.txtEndDate) Then
If strWhere <> vbNullString Then
strWhere = strWhere & " AND "
End If
strWhere = strWhere & "(" & strDateField & " < " & Format(Me.txtEndDate + 1, strcJetDate) & ")"
End If
For Each varItem In Me.lstRoom.ItemsSelected
strRoom = strRoom & ",'" & Me.lstRoom.ItemData(varItem) & "'"
Next varItem
If Len(strRoom) = 0 Then
strRoom = "Like '*'"
Else
strRoom = Right(strRoom, Len(strRoom) - 1)
strRoom = "IN(" & strRoom & ")"
End If
For Each varItem In Me.lstDevice.ItemsSelected
strDevice = strDevice & ",'" & Me.lstDevice.ItemData(varItem) & "'"
Next varItem
If Len(strDevice) = 0 Then
strDevice = "Like '*'"
Else
strDevice = Right(strDevice, Len(strDevice) - 1)
strDevice = "IN(" & strDevice & ")"
End If
For Each varItem In Me.lstCategory.ItemsSelected
strCat = strCat & ",'" & Me.lstCategory.ItemData(varItem) & "'"
Next varItem
If Len(strCat) = 0 Then
strCat = "Like '*'"
Else
strCat = Right(strCat, Len(strCat) - 1)
strCat = "IN(" & strCat & ")"
End If
For Each varItem In Me.lstStatus.ItemsSelected
strStatus = strStatus & ",'" & Me.lstStatus.ItemData(varItem) & "'"
Next varItem
If Len(strStatus) = 0 Then
strStatus = "Like '*'"
Else
strStatus = Right(strStatus, Len(strStatus) - 1)
strStatus = "IN(" & strStatus & ")"
End If
strFilter = "[c_roomid] " & strRoom & " AND [f_computername] " & strDevice & " AND [f_faultcategory] " & strCat & " AND [f_faultstatus] " & strStatus
With Reports![rptFaultRecords]
'.Filter = strFilter
.Filter = strFilter
.FilterOn = True
End With
End Sub
I am working on an Access DB that sorts and tracks my firm's business contacts. We have a form called "Contact Profile" whereby the user can select a given contact and view all of his information: First Name, Last Name, Company, Title, Email Address, etc.
On the profile, the user can update a contact's information with the "Update Info" button.
Every single field updates just fine--with the exception of Email Address. For example, I can change Joseph Smith, Programmer at Google to Joe Smith, Program Manager at GOOG with no issues.
But if I try to change joesmith#google.com to jsmith#google.com, the change does not save. Code is posted below. Could someone please take a look and let me know if they have any suggestions? Thanks!
Private Sub Command61_Click()
Dim strFirstName As String
Dim strLastName As String
Dim strIndustry As String
Dim strCountry As String
Dim strState As String
Dim strCity As String
Dim strCompany As String
Dim strTitle As String
Dim strStatus As String
Dim strPhone As String
Dim strEmail As String
Dim strOwner As String
Dim DateNow As String
'Allow user to leave some fields blank. User must fill in certain fields.
Dim VisEnable
If IsNull(Me.txtFirstName) Then
MsgBox ("Please add First Name for this Prospect")
Me.txtFirstName.SetFocus
Exit Sub
End If
If IsNull(Me.txtLastName) Then
MsgBox ("Please add Last Name for this Prospect")
Me.txtLastName.SetFocus
Exit Sub
End If
If IsNull(Me.cboIndustry) Then
Me.cboIndustry = ""
End If
If IsNull(Me.cboGeo) Then
Me.cboGeo = ""
End If
If IsNull(Me.cboInfluence) Then
Me.cboInfluence = ""
End If
If IsNull(Me.cboSchool) Then
Me.cboSchool = ""
End If
If IsNull(Me.cboTier) Then
Me.cboTier = ""
End If
If IsNull(Me.cboCompany) Then
Me.cboCompany = ""
End If
If IsNull(Me.txtTitle) Then
Me.txtTitle = ""
End If
If IsNull(Me.cboStatus) Then
Me.cboStatus = ""
End If
If IsNull(Me.cboOwner) Then
Me.cboOwner = ""
End If
If IsNull(Me.txtPhone) Then
Me.txtPhone = ""
End If
If IsNull(Me.txtEmail) Then
MsgBox ("Please add Email for this Prospect")
Me.txtEmail.SetFocus
Exit Sub
End If
If IsNull(Me.txtNotes) Then
Me.txtNotes = ""
End If
If IsNull(Me.txtInitialProspectEmailSentDate) Then
Me.txtInitialProspectEmailSentDate = ""
End If
If IsNull(Me.txtNextTouchPoint) Then
Me.txtNextTouchPoint = ""
End If
strFirstName = Me.txtFirstName
strLastName = Me.txtLastName
strIndustry = Me.cboIndustry
strCompany = Me.cboCompany
strTitle = Me.txtTitle
strStatus = Me.cboStatus
strPhone = Me.txtPhone
strEmail = Me.txtEmail
strNotes = Me.txtNotes
strOwner = Me.cboOwner
dtEmailSent = Me.txtInitialProspectEmailSentDate
dtNextTouchPoint = Me.txtNextTouchPoint
strRegion = Me.cboGeo
strSoR = Me.cboTier
strInfluence = Me.cboInfluence
strClient = Me.ckClient
strCoworker = Me.ckCoworker
strSchool = Me.cboSchool
strSQL = "Update tblProspect Set FirstName = " & """" & strFirstName & """" & ",LastName = " & """" & strLastName & """" & ",Industry = " & """" & strIndustry & """" & "" & _
",Geography = " & """" & strRegion & """" & ",StrengthofRelationship = " & """" & strSoR & """" & ",School = " & """" & strSchool & """" & ",Company = " & """" & strCompany & """" & "" & _
",Title = " & """" & strTitle & """" & ",Status = " & """" & strStatus & """" & ", InfluenceLevel = " & """" & strInfluence & """" & ", FormerClient = " & strClient & ", FormerCoWorker = " & strCoworker & "" & _
",Email = " & """" & strEmail & """" & ",Phone = " & """" & strPhone & """" & ",ProspectOwner = " & """" & strOwner & """" & ",Notes = " & """" & strNotes & """" & ""
If dtNextTouchPoint <> "" Then
strSQL = strSQL & " ,NextTouchPoint = #" & dtNextTouchPoint & "#"
End If
If dtEmailSent <> "" Then
strSQL = strSQL & " ,LastEmailDate = #" & dtEmailSent & "#"
End If
strSQL = strSQL & " WHERE Email = " & """" & strEmail & """" & ""
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
Dim ctl As Control
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acListBox, acCheckBox
If ctl.ControlSource = "" Then
ctl.Value = Null
End If
Case Else
End Select
Next ctl
Me.Visible = False
DoCmd.OpenForm "frmProspectAdmin", acNormal, , , acFormEdit, acWindowNormal
DoCmd.RunCommand acCmdSaveRecord
Form_frmProspectProfile.Refresh
Form_frmProspectAdmin.Refresh
End Sub
It comes out exactly likely I want it to in Debug.Print, but it does not save that way in the contact profile.
Debug.Print strSQL
Update tblProspect Set FirstName = "Jon",LastName = "Snow",Industry = "Other",Geography = "",StrengthofRelationship = "",School = "",Company = "",Title = "",Status = "Dead", InfluenceLevel = "", FormerClient = 0, FormerCoWorker = 0,Email = "jsnow#winterfell",Phone = "",ProspectOwner = "",Notes = ""
I am trying to implement millisecond timestamping in Access 2010/13 using this method;
MS Access Can Handle Millisecond Time Values--Really - See more at:
The Millisecond value is queried by;
SELECT DateValueMsec([DateTimeMs]) AS DateOnly FROM - to provide a date only control to sort the form from a textbox.
Any filter applied programmatically on DateOnly yeilds 0 results.
Private Sub BuildFilter()
Dim strFilter As String
Dim ctl As Control
strFilter = ""
'add selected values to string
For Each ctl In Me.FormHeader.Controls
With ctl
If .ControlType = acTextBox Or .ControlType = acComboBox Then
If Nz(.Value) <> "" Then
If InStr(.Name, "Date") <> 0 Then
If Nz(StartDate) <> "" And Nz(EndDate) <> "" And InStr(strFilter, "DateOnly") = 0 Then
strFilter = strFilter & "[DateOnly] BETWEEN #" & Me.StartDate.Value & "# AND #" & Me.EndDate.Value & "# AND "
ElseIf Nz(StartDate) <> "" And InStr(strFilter, "DateOnly") = 0 Then
strFilter = strFilter & "[DateOnly] >= #" & DateValueMsec(Me.StartDate.Value) & "# AND "
' strFilter = strFilter & "[DateOnly] >= #" & Me.StartDate.Value & "# AND "
ElseIf Nz(EndDate) <> "" And InStr(strFilter, "DateOnly") = 0 Then
strFilter = strFilter & "[DateOnly] <= #" & Me.EndDate.Value & "# AND "
End If
ElseIf InStr(.Name, "ID") <> 0 Then
strFilter = strFilter & "[" & .Name & "] = " & .Value & " AND "
Else
strFilter = strFilter & "[" & .Name & "] = '" & .Value & "' AND "
End If
End If
End If
End With
Next ctl
'trim trailing
strFilter = TrimR(strFilter, 5)
Debug.Print strFilter
With Me.subfrmzzAuditTrailDisplay
.Form.Filter = strFilter
.Form.FilterOn = True
End With
End Sub
Answer! From #pathDongle
Time is stored as Millisecond UTC;
!DateTimeMS = GetTimeUTC()
And restored by;
Public Function UTCtoTimeLocal(dSysUTC As Date) As Date
'Dim sysTime As SYSTEMTIME
Dim DST As Long
Dim tzi As TIME_ZONE_INFORMATION
DST = GetTimeZoneInformation(tzi)
UTCtoTimeLocal = dSysUTC - TimeSerial(0, tzi.Bias, 0) + IIf(DST = 2, TimeSerial(1, 0, 0), 0)
End Function
Query;
SELECT tblzzAuditTrail.DateTimeMS, FormatDate(UTCtoTimeLocal([DateTimeMS])) AS DateTimeLocal
Which can be filtered on as a String.
Private Sub BuildFilter()
Dim strFilter As String
Dim ctl As Control
strFilter = ""
'add selected values to string
For Each ctl In Me.FormHeader.Controls
With ctl
If .ControlType = acTextBox Or .ControlType = acComboBox Then
If Nz(.Value) <> "" Then
If InStr(.Name, "Date") <> 0 Then
If Nz(StartDate) <> "" And Nz(EndDate) <> "" And InStr(strFilter, "DateTimeLocal") = 0 Then
strFilter = strFilter & "[DateTimeLocal] BETWEEN '" & FormatDate(Me.StartDate.Value) & "' AND '" & FormatDate(Me.EndDate.Value) & "' AND "
ElseIf Nz(StartDate) <> "" And InStr(strFilter, "DateTimeLocal") = 0 Then
strFilter = strFilter & "[DateTimeLocal] > '" & FormatDate(Me.StartDate.Value) & "' AND "
ElseIf Nz(EndDate) <> "" And InStr(strFilter, "DateTimeLocal") = 0 Then
strFilter = strFilter & "[DateTimeLocal] <= '" & FormatDate(Me.EndDate.Value) & "' AND "
End If
ElseIf InStr(.Name, "ID") <> 0 Then
strFilter = strFilter & "[" & .Name & "] = " & .Value & " AND "
Else
strFilter = strFilter & "[" & .Name & "] = '" & .Value & "' AND "
End If
End If
End If
End With
Next ctl
'trim trailing And
strFilter = TrimR(strFilter, 5)
Debug.Print strFilter
With Me.subfrmzzAuditTrailDisplay
.Form.Filter = strFilter
.Form.FilterOn = True
End With
End Sub
Resulting Filter String;
[UserID] = 2 AND [DateTimeLocal] BETWEEN '06/01/2015 00:00:00.000' AND '07/01/2015 00:00:00.000'
As per my other question;
millisecond-time-msec2-incorrect-return