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!

Re-post dlookup and combox box

Status
Not open for further replies.

joe8915

Technical User
Jun 27, 2005
13
0
0
US
Sorry first time here. It was suggested that I should put this question in the correct forum and I concur. I have already had a couple of replies and I will paste in.

I can't seem to make this work. Please take a look at this and see where I am going wrong.

The bottom line answer I need is the field called "DUNNS"

I have a combo box and in that combo box, I have two fields
Contractor Name and Dunns.

On a form I have the unlink field with the following, but I get a error message "Name?"

REPLY: DUNCAN

genomon, thanks ever so much for the reply

I have it as a unbound txt box now.

I guess I could explain little more in detail.

Here is an example of what I trying to achieve

combo box

Field 1= Contractor Name
Field 2= Dunns Number

When I select the Contractor Name from the Combo Box, I need the Dunns number popup in the unbound text field.

I will try your suggestion as well, but I think I have already tried that as well without the ID parameter.

Once again thanks for the reply and any other suggestions.

1.DUNNS = field containing the data I need
2.Table/combo box = Tblcontractor Name
3.ID = primary key
4. This where I don't know how to call it from a combo Box


DLookUp("[dunns]","Tblcontractor Name","[ID] = ' " & Me![Contractor Name] & " ' ")

I also tried the below it work but of course I only can relate to one record

=DLookUp("[DUNNS]","Tblcontractor Name","[id]=3135")

Any help would be appreciated

Thanks


REPLY FROM genomon (Programmer)

You are only returning one record - use a text box. If you want to return multiple records, use an SQL statement as the RowSource of the combo box, without the ID parameter.
 

Private Sub YourComboBox_AfterUpdate()
Me.YourUnboundTextbox = Me.YourComboBox.Column(1)
End Sub

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Thank you ever so much, work like a charm
 
Folks

Trying to use the Dlookup function. I have viewed FAQ 705-4978, but can't make it work.

I have a form where there are two combo boxes which select two "Reasons for Failure", one being a Primary and the other being a Secondary. I want to select the Primary cause in the first combo and then in the second combo only to select those Secondary causes that are related to the Primary. I then want to hold this data in a data table for later analysis. I have two tables Primary and Secondary. The Primary holds just the Primary reason, while the secondary holds both Primary and Secondary. So, for instance, in the Primary there is "Customer Caused" whilst in the Secondary there is "Customer Caused" (Primary field) and then Secondary Cause field reasons like "Not In", "No longer Required", "Cancelled Earlier" etc etc.

I am using the Dlookup function =DLookUp("[Secondary]","[SecondaryFailureReasons2]","[Primary]=forms!Frm_Data![PrimaryReason]") in the Row Source line os combo 2, but all I get is a blank. I can make it work using a query, but since this is going to used by several users, I felt that Dlookup is more dynamic and does not lock the data.

Can anybody help me out here. I know its a long post, but I am trying to make this as clear as possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top