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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie form/expression help

Status
Not open for further replies.

Cassaro

MIS
Jul 19, 2001
202
0
0
US
I have had only limited exposure to Access but now I find myself needing to create a form that has one area populated by an expression but no matter what I try I simply cannot get it to work. I'm sure I must be missing something simple but after hours and hours working on this I need some direction from experts in the field.

I have a form that the user will input a customer number in the [Cust] field. This input should reference the [Cust] field in an [Customer] table and return the [Cust Name] to the [Name] field in the form.
One of the expressions I have used is the following with no success =DLookUp([Cust Name],[Customer],[Cust]=Forms![Name]) If anyone can help point me in the right direction I will highly appreciate it.

Thanks!

Chuck

 
send me your request and I will send you a sample dababase that will do this.

rollie@bwsys.net
 
It's your Dlookup Function. Took me a while to figure it out -- and it was scriverb who got me over the hump (credit where credit is due...). Try something like this:

Dim F as Form
Set F = Me
Dim tempvariable as string

tempvariable = F!field in T_TableYouAreUsing
WhatEverYouAreFillingIn=Dlookup("Field in reference table","Name of reference table","[common field in reference table]='" & tempvariable & "'")

The bit with the quotes in the third clause in the Dlookup is kinda critical. Counterintuitive, but critical.

HTH,
Chris

-->Just because you can, doesn't mean you should.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top