Computing.Net > Forums > Office Software > defining controlsource in access 2k

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

defining controlsource in access 2k

Reply to Message Icon

Name: gaayathiri
Date: May 11, 2005 at 17:53:38 Pacific
OS: xp pro
CPU/Ram: 256
Comment:

hi,
biulding the sports database still.(office/wwwboard/forum/4630.html)

I am building a form based on a table. I am trying to :

1. grab the selection made from a combo box(Event Name)

2.compare it to a field in a table (EventsDetail)

3.Return the matching Event id from the table.

I tried Dlookup - maybe I am doing something wrong.can any1 help?

=DLookUp("[EventID_tbl]","EventsDetail","[EventName_tbl] =[Combo22] "))

combo22 is the "EventName" selection combo box.



Sponsored Link
Ads by Google

Response Number 1
Name: smithdk
Date: May 11, 2005 at 20:03:43 Pacific
Reply:

Yes DLookup will do this. Your DLookup command has an extra right parenthesis.


0

Response Number 2
Name: gaayathiri
Date: May 11, 2005 at 20:33:40 Pacific
Reply:

hi
thnx. i fixed the paranthesis..to no avail. it now comes up with #error

also, even tho' the event name is listed, it won't get choosen..any idea why?


0

Response Number 3
Name: smithdk
Date: May 11, 2005 at 20:42:12 Pacific
Reply:

Are you putting this in the control source of something? If so, there is no error checking. I would suggest to put this in an event procedure (code) so that it does error checking for you. It can be on the 'after update' property of the combo box. You can even put the stop command right after the dlookup command to check the value you get via the immediate window. Once you get it down right, you can then copy the dlookup command to the control source.


0

Response Number 4
Name: gaayathiri
Date: May 11, 2005 at 20:50:41 Pacific
Reply:

the combo box that lists the event names is just listing them, I can scroll thru the list but when I click on one of entries in the list, nothing happens.

I need to fix the above, before trying to put the =DLookUp("[EventID_tbl]","EventsDetail","[EventName_tbl] =[Combo22] ") in after update of the combo box.( I don't understand why I have to put this in the combo box..I am trying to get the value in a txt box.) also, what is the stop command? I am a beginner, so don't know about code building either


0

Response Number 5
Name: smithdk
Date: May 11, 2005 at 21:03:48 Pacific
Reply:

I only want you to run this as code someplace since it can error check for you. It is very useful to troubleshot issues like this. The stop command just stops the code from running at that point. You can then open what is called an immediate window to check any values in the code. If for instance your dlookup command returns the wrong value, you can actually retype the dlookup command as many times as you want in the immediate window until you get the right value.

I only chose the combo box since I thought you needed to pick something from the combo box before getting the value with dlookup. I understand you want the value stored in a text box.

The code would simply be something like this:

[textboxname]=DLookUp("[EventID_tbl]","EventsDetail","[EventName_tbl] =[Combo22] ")

It is getting late here. I will check back later tomorrow.


0

Related Posts

See More



Response Number 6
Name: mdow
Date: May 12, 2005 at 05:19:19 Pacific
Reply:

There are a few issues here.
1) It appears to me that the DLookup function is referencing a table in the where clause that is different then the domain you entered.

2) [Combo22] should not be contained within the string. You need to close the string after the = sign and then add '& [combo22])' without the quotes of course.

3) Yes, the dlookup function would be in the text box not the combo box.

4) You need to put the code
Forms!FormName.Refresh in the after update event of the combobox.

5) You need to add the Nz function to your textbox to handle when there is no value in the combobox, for example =Nz(dlookup(...))


0

Response Number 7
Name: gaayathiri
Date: May 12, 2005 at 16:24:29 Pacific
Reply:

thanks guys.

managed to fix it. fiddled around along the lines of the advice. it needed the refencing fixed.

thnx again.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: defining controlsource in access 2k

Calculations in Access 2000 www.computing.net/answers/office/calculations-in-access-2000/3246.html

Access 2K Remote File Display www.computing.net/answers/office/access-2k-remote-file-display/4375.html

Access 2K on Internet? www.computing.net/answers/office/access-2k-on-internet/4857.html