Solved

Access - DLookup in Query?

Posted on 2007-11-19
1
415 Views
Last Modified: 2010-05-19
Hi,
Is there anyway to look up a value from a text field on one of my forms from a query? I dont know if this can be done via DLookup or something? An example would be;

Select DateUpdated from tblDate Where DateUpdated = #Forms!frmAddData!TextDate.Value#

Thanks
0
Comment
Question by:andyb7901
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 20311447
Your command is essentially correct but it needs adjusting depending on where you are running the query,
If this is a saved query you can omit the # #.

If you are using it for a recordset in code then you need something like:

dim strsql
strsql = "Select DateUpdated from tblDate Where DateUpdated = #" & Forms!frmAddData!TextDate.Value & "#"
set rs = db.openrecordset(strsql)

If you still can't sort it out then post back and explain what you are trying to do.



0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question