Hi,
I modified a code for a search form to open a form for a specific criteria as one of the search fields was not working. Now it works but the problem is I get the Enter Parameter pop up for Date; time! Here is the code:
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = ""
If Trim(txtcustname) <> "" Then
stLinkCriteria = "[customer]=" & Me![txtcustname]
End If
If Trim(txtterms) <> "" Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria + " And "
End If
stLinkCriteria = stLinkCriteria + "[terms#]='" + Trim(UCase(txtterms)) + "'"
End If
If Trim(txtrma) <> "" Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria + " And "
End If
stLinkCriteria = stLinkCriteria + "[rma#] = '" + Trim(UCase(txtrma)) + "'"
End If
If Trim(txtintrma) <> "" Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria + " And "
End If
stLinkCriteria = stLinkCriteria + "[internalrma] = '" + Trim(UCase(txtintrma)) + "'"
End If
If Trim(txtpo) <> "" Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria + " And "
End If
stLinkCriteria = stLinkCriteria + "[po#]='" + Trim(UCase(txtpo)) + "'"
End If
If Trim(txtmemo) <> "" Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria + " And "
End If
stLinkCriteria = stLinkCriteria + "[creditmemo]='" + Trim(UCase(txtmemo)) + "'"
stDocName = "frm_find-memo"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.close acForm, "frm_detail-find"
Exit Sub
End If
If Trim(txtquote) <> "" Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria + " And "
End If
stLinkCriteria = stLinkCriteria + "[quote#]='" + Trim(UCase(txtquote)) + "'"
End If
If Trim(txtway) <> "" Then
If Len(stLinkCriteria) > 0 Then
stLinkCriteria = stLinkCriteria + " And "
End If
stLinkCriteria = stLinkCriteria + "[waybill#] = '" + Trim(UCase(txtway)) + "'"
stLinkCriteria = stLinkCriteria + " And "
stLinkCriteria = stLinkCriteria + "[courier] = '" + Trim(UCase(txtcourier)) + "'"
stDocName = "frm_find-part-detail"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.close acForm, "frm_detail-find"
Exit Sub
End If
stDocName = "frm_r"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.close acForm, "frm_detail-find"
Exit_search_Click:
Exit Sub
Can anyone tell what is wrong with it? Here is the modification I added:
stLinkCriteria = ""
If Trim(txtcustname) <> "" Then
stLinkCriteria = "[customer]=" & Me![txtcustname]
End If
the customer field is numeric and the txtcustname is a combo box showing the name of the customer but the bound column is the ID of the customer so both are numeric...Can anyone help!
Thanks
--
Message posted via http://www.accessmonster.com