populate checkbox labels

BadScript

Registered User.
Local time
, 21:06
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...
 
is your form bound to tblReasons?
 
Tried to use the DLookup function

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

But must still be doing something wrong? :confused:
 
It would be a very good idea to answer Wazz's question!
 
Oh yes, apology I see it now..
My form is not bound to any tables..
 
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

Back
Top Bottom