Dlookup VBA Questions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code in the after update in my combo box. It's now
producing any any informaton in my text box

Private Sub cboAMUProcess_AfterUpdate()
Me.Question1 = DLookup("[Questions]", "[tblAMUQuestions]",
"[Process]='" & Me.cboAMUProcess & "'")

End Sub

Can someone please advise what I am doing wrong?
 
Welthey said:
I have the following code in the after update in my combo box. It's
now producing any any informaton in my text box

Private Sub cboAMUProcess_AfterUpdate()
Me.Question1 = DLookup("[Questions]", "[tblAMUQuestions]",
"[Process]='" & Me.cboAMUProcess & "'")

End Sub

Can someone please advise what I am doing wrong?

Many ComboBoxes contain one value in a hidden column while displaying another.
If yours is like that then you are referring to the hidden value which might not
be the correct one for your DLookup function.
 
Welthey,
Since your not getting a "syntax" problem, we should be able to set that aside.
I usually don't use the Me. object within DLookups
Me.Question1 = DLookup("[Questions]", "[tblAMUQuestions]", "[Process] = '" & cboAMUProcess
& "'")

The primary thing to suspect is that the cbo is not delivering a legitimate value for
[Question]
Try this trick to verify the contents of your cbo. Place an unbound text control on
the form with a ControlSource of...
= cboAMUProcess
Is that a legitimate (and unique) [Question] value?
Otherwise...
Please describe your cbo (bound vs unbound), RowSource/columns, and your cbo
properties. (NoOfCols, Columnwidths, and BoundColumn)
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
Welthey said:
I tried your idea and I am getting the ID number in the unbound text
box. How do I set up the combo box to read the 2 column not the first?


Me.Question1 = DLookup("[Questions]", "[tblAMUQuestions]", "[Process] = '" &
Me.cboAMUProcess.Column(1) & "'")

The columns start with zero so Column(1) is the second column.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Many checkboxes to one label 20
DLookup Function 2
Dlookup help Please !! 1
DLookup error 1
DLookUp behavior 1
DLookup 1
dlookup 2
VBA Question 4

Back
Top