Text box Control Source (1 Viewer)

anb001

Registered User.
Local time
Tomorrow, 00:39
Joined
Jul 5, 2004
Messages
197
I'm trying to create an Expression as Control Source for a Text Box.

An example which can be found is:

Code:
=DLookup("[ProductName]", "Products", "[ProductID] =" & Forms![Order Details]!ProductID)

In above example the criteria is based on [ProductID] on a form.

Is it possible to change it, so criteria is based on a value from a specific query, i.e. similar as above?

I have tried something like this, but it doesn't work:

Code:
..... & Query![QRYORDER]!ProductID)
 

Minty

AWF VIP
Local time
Today, 23:39
Joined
Jul 26, 2013
Messages
10,387
You could do this in VBA by passing the result of your query into the Dlookup, but I don't think you can refer to a query in the control source of the form, but it seems like you might be approaching this from the wrong direction.

I think you could probably get this data from the record source for the form?

Can you describe in more detail what your data is and what you are trying to achieve? Some table and field descriptions will be a great help.
 

anb001

Registered User.
Local time
Tomorrow, 00:39
Joined
Jul 5, 2004
Messages
197
Managed to get it done. It was a little more simple that I thought. I have the query as record source for the form, so:

Instead of the:
..... & Query![QRYORDER]!ProductID)

It was just like this:
..... & '[ProductID]')
 

Users who are viewing this thread

Top Bottom