Populate multiple controls from query datasheet (1 Viewer)

Zydeceltico

Registered User.
Local time
Yesterday, 22:28
Joined
Dec 5, 2017
Messages
843
Hi All -

If I have a query that always returns at least one and no more than two records and I have a form that has two unbound text box controls on it - - Is it possible to run my query from a button on the form using a value in a different control on the form and place the value of a single field in each of the two unbound text box controls?

In other words, I have a product that is made up of 2 parts. The form already has the ProductID. I want to be able to click a button and have a query run using the ProductID to populate two other textboxes so I can see the 2 parts that make up the product.

Currently I would like to not use a datasheet but will if that is the only way,

Thanks!

Tim
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:28
Joined
Oct 29, 2018
Messages
21,455
Hi Tim. Not sure what you're doing exactly but you could try using the DLookup() function as the control source for your textboxes and you don't need any button to run the query at all.
 

isladogs

MVP / VIP
Local time
Today, 03:28
Joined
Jan 14, 2017
Messages
18,209
Well I've never done it but you could use a DMin expression to get the value from the first record.
Use DCount to check if more than one record and if so use DMax expression for the second record otherwise leave blank.
 

Minty

AWF VIP
Local time
Today, 03:28
Joined
Jul 26, 2013
Messages
10,368
Why not just use a small continuous subform (as a form, not a datasheet) with all the controls hidden to make it look like a pair of stacked controls, and link it back to the parent id?
 

Zydeceltico

Registered User.
Local time
Yesterday, 22:28
Joined
Dec 5, 2017
Messages
843
Why not just use a small continuous subform (as a form, not a datasheet) with all the controls hidden to make it look like a pair of stacked controls, and link it back to the parent id?

I've never used continuous forms before so you piqued my curiosity and I just finished watching several videos ( starting here: https://www.accessallinone.com/access-2013-55-continuous-forms-1-basic-form-design/ ) and I am pretty excited. I have many uses for this and wish I had known about them earlier.

Thanks for shedding some light!

Tim
 

Users who are viewing this thread

Top Bottom