populate checkbox labels (1 Viewer)

BadScript

Registered User.
Local time
Yesterday, 23:21
Joined
Oct 30, 2007
Messages
73
I have a form with a couple of checkboxes, the labels of the checkboxes are named lbl_chk1 to lbl_chk10.

I have a table that is called tblReasons, this table contains 2 columns:
reasonID and DGD.

I'd like my checkbox labels to display a value from this table, so I probably needs something like this in the loadevent of my form:

lbl_chk1.Caption must display * FROM tblReasons.DGD WHERE reasonID = 1
lbl_chk2.Caption must display * FROM tblReasons.DGD WHERE reasonID = 2 etc..

I really have no idea on how to do this or if it is even possible...
 

wazz

Super Moderator
Local time
Today, 14:21
Joined
Jun 29, 2004
Messages
1,711
is your form bound to tblReasons?
 

BadScript

Registered User.
Local time
Yesterday, 23:21
Joined
Oct 30, 2007
Messages
73
Tried to use the DLookup function

lbl_chk1.Caption = DLookup("DGD", "tblReasons", "reasonID = 1")

But must still be doing something wrong? :confused:
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 07:21
Joined
Jul 9, 2003
Messages
16,364
It would be a very good idea to answer Wazz's question!
 

BadScript

Registered User.
Local time
Yesterday, 23:21
Joined
Oct 30, 2007
Messages
73
Oh yes, apology I see it now..
My form is not bound to any tables..
 

BadScript

Registered User.
Local time
Yesterday, 23:21
Joined
Oct 30, 2007
Messages
73
I got it to work now using the DLookup function:

lbl_chk1.Caption = DLookup("[DGD]", "tblReasons", "[reasonID] = 1")

But I understand DLookup is slow, is there a better way to do this?
 

Users who are viewing this thread

Top Bottom