PC Review


Reply
Thread Tools Rate Thread

Dlookup VBA Questions

 
 
=?Utf-8?B?V2VsdGhleQ==?=
Guest
Posts: n/a
 
      26th Dec 2006
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?
 
Reply With Quote
 
 
 
 
Rick Brandt
Guest
Posts: n/a
 
      26th Dec 2006
Welthey wrote:
> 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.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
Al Campagna
Guest
Posts: n/a
 
      26th Dec 2006
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" <(E-Mail Removed)> wrote in message
news:01AE22B5-435D-4849-9366-(E-Mail Removed)...
>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?



 
Reply With Quote
 
Rick Brandt
Guest
Posts: n/a
 
      26th Dec 2006
Welthey wrote:
> 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.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DLookup, unbound controls questions JIM Microsoft Access Form Coding 0 26th Jan 2009 10:53 PM
Re: Dlookup function - copying the dlookup info into a field.... Douglas J. Steele Microsoft Access Forms 0 6th Dec 2006 02:05 PM
DLookup questions Frederick Chow Microsoft Access 3 24th Jul 2005 06:14 PM
2 questions: DLookup and Chr(13)/Chr(10) tina Microsoft Access VBA Modules 2 21st Aug 2004 08:09 AM
Dlookup problems (was my Dlookup hell) Kavvy Microsoft Access Form Coding 3 18th Nov 2003 12:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:44 PM.