Dlookup: multiple results from a single field (1 Viewer)

RoboCop1

New member
Local time
Yesterday, 21:03
Joined
Jul 22, 2022
Messages
1
Hello Access World,
I'm brand new to using access so I'm hoping someone can help me with an issue. I can do a vlookup in excel but i cant seem to figure out the dlookup for access. I just cant find anything on this. And i hope my question makes sense.

Im trying to figure out a dlookup code for an "AfterUpdate" action for a Form. I already know that i need to go into the property sheet.

So i have Table1 (which is actually the 2nd table) and a Form.
I need the form to automatically populate DESC1 and DESC2 when a room number is entered based on ID primary keys record no matter where the primary key is sorted on table.

View attachment 101954
 
Last edited:

Jon

Access World Site Owner
Staff member
Local time
Today, 02:03
Joined
Sep 28, 1999
Messages
7,383
Welcome to the forums! We are the most active Microsoft Access community on the internet by far, with posts going back over 20 years!

To get started, I highly recommend you read the post below. It contains important information for all new users to this forum.

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We look forward to having you around here, learning stuff and having fun!
 

Gasman

Enthusiastic Amateur
Local time
Today, 02:03
Joined
Sep 21, 2011
Messages
14,231
Here is info on DLookup()

If the ID control was a combo, you could bring in the descriptions as extra columns.
 

plog

Banishment Pending
Local time
Yesterday, 20:03
Joined
May 11, 2011
Messages
11,638
I need the form to automatically populate DESC1 and DESC2 when a room number is entered based on ID primary keys record no matter where the primary key is sorted on table.

This doesn't smell right. A Dlookup retrieves data from a table. What table do you want to retrieve data from?

Before you say 'Table1', there's no need. If your form is based on Table1, you don't need to retrieve data from it, its already available. Do you have another table that holds description information for your rooms? If so, you can do a Dlookup into that table, but you would not store the description data in Table1--you would simply show it on the form,
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 18:03
Joined
Oct 29, 2018
Messages
21,453
Hi. Welcome to AWF!

It might be easier to use a Combobox in your case.

Just a thought...
 

Users who are viewing this thread

Top Bottom