Button to open form and filter (1 Viewer)

theinviter

Registered User.
Local time
Today, 04:21
Joined
Aug 14, 2014
Messages
240
Dears;
I have a form which has a button, upon clicking on the button, ten wanna open another form and filter record to 2 criteria,
But if no record then open new record and copy the "Item Code1" to " Item Code" in the new form. so i tried this code to open and filter but not working.
so please any help and guideance.
Item code is text field
Private Sub Command717_Click()
DoCmd.OpenForm "Clinic_Response", acNormal, " [Item Code] = '" & Me.[Item Code1] & "' and [Clinics_Location] = " & Me.Location_Code
End Sub
 

Ranman256

Well-known member
Local time
Today, 07:21
Joined
Apr 9, 2015
Messages
4,339
don't use filter, so put 3 commas for the where:

DoCmd.OpenForm "Clinic_Response", , , " [Item Code] = '" & Me.[Item Code1] & "' and [Clinics_Location] = " & Me.Location_Code
 

theinviter

Registered User.
Local time
Today, 04:21
Joined
Aug 14, 2014
Messages
240
thanks that's work,
but i need , Afetr opening
1- filer as above (Done)
2- if no record found , then copy the item code form current record " MRN Query1" to new record on "Clinic_Response" .
 

Users who are viewing this thread

Top Bottom