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

DLookUp Problem

Status
Not open for further replies.

Minkers

Technical User
Dec 15, 2004
70
US
I've attempted to set this in many way, but I am having trouble. Below are two sets of code I have tried to get a unbound text box to link to a linked Excel document. Neither of them work and I am not sure why. Any suggestions would be appreciated.

Dim Address As String

Address = "[Forms]![frmMenu]!cboModel.column(3)"
Me.txtExcel.Value = DLookup(Address, "SigandSun2005")

Me.txtExcel.Value = DLookup("[Forms]![frmMenu]!cboModel.column(3)", "SigandSun2005")


I am not sure why neither of them work. The value that is supposed to be passed on is "F1" and if I use me.txtExcel.value=DLookUp("F1","SigandSun2005") works to display the value just fine but the form represents over 100 different choices and can be any of them. On this cboModel box is the correct cell for the choice made, but the information is not passing on. Any idea how to fix it?
 
Have you tried removing the quotes around Forms!frmMenu!cboModel.Column(3)?


Randy
 
Yes I have, I get an error then though, "Run-time error '2448' You can't assign a value to this object.
 
What if you change this....
Me.txtExcel.Value = DLookup([Forms]![frmMenu]!cboModel.column(3), "SigandSun2005")

to this....
Me.txtExcel = DLookup(Forms!frmMenu!cboModel.column(3)", "SigandSun2005")


Randy
 
That code gives me "Runtime Error '-21473567 (800200009) You can't asign a value to this object.
 
Can't see how to edit my post, so I will post a second time, sorry. I also tried Me.txtExcel = DLookup("Forms!frmMenu!cboModel.Column(3)", "SigandSun2005") but on adding the "" I get the error "Runtime Error '3085' Undefined function forms!frmMenu!cboModel.column in Expression.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top