DlookUp Problem

pinkpanther6666

Board Regular
Joined
Feb 13, 2008
Messages
194
Office Version
  1. 365
Platform
  1. Windows
I have a text box on my subform that i would like to be filled with Data from a table via the Dlookup Command.

My table is

Table Name -----> Player

Field ..............ID.................AutoNumber
Field ...............Team............Looks Up Vale in another table
Field ...............PlayerName...Text Box
Field ...............XYZ...............Text Box


Subform --------->frmMain

Text93..............Textbox .........Wants the value of XYZ from the table Player
Combo2............ComboBox.......Contains the PlayersName


What i would like to happen is i select the player using combo2 and the value of XYZ from the Player table appears in this text box.

I have tried and tried with various combinations using the Dlookup command and cant get it to work.


i have set up another "dummy" database and i can get it to work but the only change is that combo2 is a text box

I dont know if that has anything to do with it.


many many thanks to anyone that can help me with this please


Steve
 
Last edited:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
All,

Im using the formulae below


=DLookUp("XYZ","Player","PlayerName = " & [Me].[frmMain.form].[Form]![Combo2])

but this is returning the error #Name?

Hope this helps


Steve
 
Upvote 0
Always let us know the data types when posting so we don't have to guess. If the combo is text (as opposed to a number, for example) it makes a difference. I'm going to assume it's text. Try =DLookUp("XYZ","Player","PlayerName = '" & [Combo2] & "'")
However, I don't know what event you're using to do this, so you might need to drill down to the subform like this:
[Forms]![frmMain].[subform control name].[Form]![Combo2]=DLookup....
You did not post the name of your subform or the control that holds it. Whatever the subform name is, I'm betting the subform control has the same name as the subform. The syntax for referencing a subform control is
[Forms]![Main form name]![subform control name].[Form]![control name on subform]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,248
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top