token_remedie
Registered User.
- Local time
- Tomorrow, 03:24
- Joined
- Jul 7, 2011
- Messages
- 78
I can't get this to work and I've tried several methods. ok so basically I'm trying to create a query or report (I don't care which) based on criteria filled out from several comboboxes. The tables fields are:
Asset Number, Location Name, Asset Description, Serial no, Invent no, Location, Manufacturer and deployment schedule.
The search query needs to be able to pull from any or all of these but if some are null that's cool too. The biggest issue I've had so far is the null values. so far I've tried:
* Putting forms![searchform]![cmbassetnum] in the criteria and that works for one, but when I do it to all of them it breaks it.
* tried if else like this:
f Not IsNull(Me![Cmbassetnum]) Then
strWhere = "([searchquery]![asset number] =" & _
[Forms]![searchform]![Cmbassetnum] & ") And "
Else
GoTo continue
End If
If Not IsNull(Me![cmbmanuf]) Then
strWhere = strWhere & "([searchquery]![manufacturer] =" & _
Me![cmbmanuf] & ") And "
Else: GoTo continue
lngLen = Len(strWhere)
If lngLen = 0 Then
MsgBox "Please enter search criteria!"
Else
strWhere = Left$(strWhere, lngLen)
stDocName = "rptsearchquery"
DoCmd.OpenReport stDocName, acPreview, , strWhere
End If
that's not the entire code but you get what I've done....
tried this:
Private Sub Cmbassetnum_AfterUpdate()
stDocName = "searchquery"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End Sub
and that was off track and didn't work anyway
Any help would be greatly appreciated, and I've searched this forum extensively which is how I've gotten this far but I'm just missing something somewhere.
Asset Number, Location Name, Asset Description, Serial no, Invent no, Location, Manufacturer and deployment schedule.
The search query needs to be able to pull from any or all of these but if some are null that's cool too. The biggest issue I've had so far is the null values. so far I've tried:
* Putting forms![searchform]![cmbassetnum] in the criteria and that works for one, but when I do it to all of them it breaks it.
* tried if else like this:
f Not IsNull(Me![Cmbassetnum]) Then
strWhere = "([searchquery]![asset number] =" & _
[Forms]![searchform]![Cmbassetnum] & ") And "
Else
GoTo continue
End If
If Not IsNull(Me![cmbmanuf]) Then
strWhere = strWhere & "([searchquery]![manufacturer] =" & _
Me![cmbmanuf] & ") And "
Else: GoTo continue
lngLen = Len(strWhere)
If lngLen = 0 Then
MsgBox "Please enter search criteria!"
Else
strWhere = Left$(strWhere, lngLen)
stDocName = "rptsearchquery"
DoCmd.OpenReport stDocName, acPreview, , strWhere
End If
that's not the entire code but you get what I've done....
tried this:
Private Sub Cmbassetnum_AfterUpdate()
stDocName = "searchquery"
DoCmd.OpenQuery stDocName, acNormal, acEdit
End Sub
and that was off track and didn't work anyway
Any help would be greatly appreciated, and I've searched this forum extensively which is how I've gotten this far but I'm just missing something somewhere.