Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup syntax

Status
Not open for further replies.

jmstarbuck

Programmer
Aug 11, 2003
90
US
I am having trouble to get Dlookup to work in a form that it once worked in. However, I've renamed some things and I can't get it working again.

Here's the setup:

I have a mainform named BidRequest_Form. Contained in it is a continuous form named Bids_subform

The Dlookup is in the subform, as is the control CompanyCmb (datasource=CompanyID). I've tried setting my form field equal to the following:

Code:
=DLookUp("MinorityCode","SkilledLabor","ID = " & Forms!BidRequest_Form!Bids_subform.Form!CompanyCmb)

I've also tried:
Code:
=DLookUp("MinorityCode","SkilledLabor","ID = " & Me!CompanyCmb)

The table is SkilledTrades the field is MinorityCode.

Any light would be greatly appreciated. I have referred to the Syntax for Main/Subforms document, but I must be missing something.

J
 
How are ya jmstarbuck . . .

If the TableName is [blue]SkilledTrades[/blue] ... why is the [blue]domain[/blue] argument set to [red]SkilledLabor[/red]?

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Whoops! SkilledLabor is the correct table name. Sorry, my head is spinning.

Any other thoughts?
 
I just got this work. The problem was that the BidRequest_Form had been opened by a form that had been opened using ACDialog. I was working on another problem and happened to change that and the DLookup started working.

On the form opened with ACDialog I couldn't reference controls on other open forms. Can that be true? Does anyone have a good reference doc on this?
 
jmstarbuck said:
[blue]On the form opened with ACDialog [purple]I couldn't reference controls on other open forms.[/purple][/blue]
Microsoft Access said:
[blue]When a form opens as a modal form, you must close the form before you can move the focus to another object.[/blue]
So ...

Reference controls on other forms ...Yes!
Set Focus to controls on other forms ... No!

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top