Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Syntax to get Data not working in SQL Server

Status
Not open for further replies.

kensaffer

Programmer
Jan 7, 2005
39
0
0
US
Using Access 2000 and upsized to SQL Server so this ocde was working fine in the MDB.
Got a set of forms that use a query to retrieve the data/ The query is Select.... WHERE (((ADtbl.MRN)=[Forms]![PatientFrm]![MRN]));
The PatientFrm.MRN is the data search criteria with the user not being asked except when the main form is entered. When I run the query I am prompted for a MRN. so it works fine in the MDB.
In the ADP all the data is retrieved. The VIEW has this code
WHERE (MRN = N'(ADtbl.MRN)=[Forms]![PatientFrm]![MRN]')
I've changed it to
WHERE (MRN = N'[Forms]!PatientFrm!MRN')

BUT neither one works, it doesn't ask me for a MRN and retrieves all the data.
Help.......What should the critera syntax be ?
 
Set the RecordSource property of the form to something like this:
"SELECT ... WHERE MRN=N'" & Forms!PatientFrm!MRN & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you for the tip BUT nothing happened. Actually the sam ething happened as before where no data was retrieved and when I ran it in Query, I was not prompted for an MRN.
So this didn't work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top