Using A Query As Default Value

M

Mrstacy

On a data entry form, I'd like to allow the user to see the previous
value of a certain field and use that value or overwrite if necessary.

I made a query and referened it in the default value of the field on
the form as shown below, but it does not work

=[QryComplaint]![Complaint]

The query basically says use the primary key on the current screen to
locate the value of the most recent entry. see below

SELECT Tbl_VisitInformation.Complaint
FROM Tbl_VisitInformation
WHERE (((Tbl_VisitInformation.PatId)=[Forms]![Frm_Patient_Visit_Add]!
[PatId]));

Windows XP
Access 2003
 
M

Mrstacy

I think I need to use Dlookup. I put this, but it still does not
work. I see "Error" in the field on the form. Searchname contains a
patient ID key.

=DLookUp("[Complaint]","QryComplaint","[PatID] = " & [Forms]!
[Frm_Patient_Visit_Add]![SearchName])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top