Search Query

Status
Not open for further replies.

whojstall11

Registered User.
Local time
Today, 07:42
Joined
Sep 7, 2011
Messages
94
I have a form that searches my data query but when i enter in data it gives me my whole database. Here is what my formula looks like
Field: MRN
Table: General
Sort:
Show: checked
Criteria: Like "*" & [Forms]![Search]![MRN] & "*"
 
Is MRN text or numeric? If text you would need to change it to:

Like "'*" & [Forms]![Search]![MRN] & "*'"

with the extra single quotes.
 
Ok i tried that now it doesnt give me an output
 
SELECT General.MRN, General.[Patient Last Name], General.[Patient First Name], General.DOB
FROM [General]
WHERE (((General.MRN) Like "'*" & [Forms]![Search]![MRN] & "*'") AND ((General.[Patient Last Name]) Like "*" & [Forms]![Search]![Patient Last Name] & "*") AND ((General.[Patient First Name]) Like "*" & [Forms]![Search]![Patient First Name] & "*") AND ((General.DOB) Like "*" & [Forms]![Search]![DOB] & "*"));
 
You didn't appear to get the link between what I said and showed in my change to your query and what you have in the other references to the form controls.

SINGLE QUOTES, SINGLE QUOTES, SINGLE QUOTES, SINGLE QUOTES....

for text fields. Look at your query very closely and see that the one that is for the MRN is correct where all of the others are not.
 
Ok thank you this is my new code and it still giving me blank output
SELECT General.MRN, General.[Patient Last Name], General.[Patient First Name], General.DOB
FROM [General]
WHERE (((General.MRN) Like "'*" & [Forms]![Search]![MRN] & "*'") AND ((General.[Patient Last Name]) Like "'*" & [Forms]![Search]![Patient Last Name] & "*'") AND ((General.[Patient First Name]) Like "'*" & [Forms]![Search]![Patient First Name] & "*'") AND ((General.DOB) Like "'*" & [Forms]![Search]![DOB] & "*'"));
 
Sorry, I didn't notice you had a date field in there. It just looked like text fields. You need to make one more modification for DATES. You use the octothorpe (#) instead of a single quote (') and, depending on your location, you might need to also format the date to a non-ambiguous format.
 
boblarson thank for the help but its still no change can you look at my database for me. https://rapidshare.com/files/2180047708/final3.rar

Sorry, I can't download from there. If it is Access 2003 or earlier and you were able to upload here it would work better. Just run COMPACT AND REPAIR and then right click on the file and select SEND TO > COMPRESSED FOLDER to zip it to a zip file and you can upload it here if it is 2MB or less after zipping.

Or post the SQL that you came up with after I told you about the octothorpes.
 
I have done more stuff to it basically im trying to have the person looking for data, type in any part of information of the patient they are looking such as: name dob etc.............. when typed in the Search Form the results go to the Search Results subform then when you find the data you are looking for it suppose to send you to the Patient Data form so they will be able to edit it or to look at all thier information.
 

Attachments

Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom