By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,439 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,439 IT Pros & Developers. It's quick & easy.

How can I get the record from subform?

P: n/a
Hi, I am new in MS Access. I am using MS Access 2002. I have a main
form which has 10 label (from label1 to lable10), main form also has a
subform which has 10 records. Subform has 2 column (one is Position ID
another one is Status) How can I get the records from the subform and
then change the label color.

for e.g. - Position ID =1 and the Status = "Open" then the
Label1.backcolor=Red
Position ID =2 and the Status = "Open" then the
Label2.backcolor=Red
Position ID =3 and the Status = "Close" then the
Label3.backcolor=Blue
Position ID =4 and the Status = "Cancelled" then the
Label4.backcolor=Green
.....

Do I need to use for Loop? how? Please teach me. Thanks in advance
Michael

Oct 2 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

cy*********@gmail.com wrote:
Hi, I am new in MS Access. I am using MS Access 2002. I have a main
form which has 10 label (from label1 to lable10), main form also has a
subform which has 10 records. Subform has 2 column (one is Position ID
another one is Status) How can I get the records from the subform and
then change the label color.

for e.g. - Position ID =1 and the Status = "Open" then the
Label1.backcolor=Red
Position ID =2 and the Status = "Open" then the
Label2.backcolor=Red
Position ID =3 and the Status = "Close" then the
Label3.backcolor=Blue
Position ID =4 and the Status = "Cancelled" then the
Label4.backcolor=Green
.....

Do I need to use for Loop? how? Please teach me. Thanks in advance
Hi Michael,

Not sure if I'm exactly grasping your question, but it *sounds* like
you want to make a clone of the recordset behind your subform, and loop
through that to work out the statuses of your records and determine the
colors of your labels.

You can read a little more about RecordSetClone here:

http://msdn.microsoft.com/library/de...rdsetClone.asp

Others may have better suggestions...

Regards,

pt

Oct 2 '06 #2

P: n/a
Hi pt

Thanks for your response. I had read this example and made some change.
Unforturnately it can't change the label background color on the main
form. Maybe I confused you. My problem is when I load the form, All
Labels in the main form will automatic change the color according to
the "status" column on the Subform, just like my example below. Any
idea?

Thanks again
Michael

planetthoughtful wrote:
cy*********@gmail.com wrote:
Hi, I am new in MS Access. I am using MS Access 2002. I have a main
form which has 10 label (from label1 to lable10), main form also has a
subform which has 10 records. Subform has 2 column (one is Position ID
another one is Status) How can I get the records from the subform and
then change the label color.

for e.g. - Position ID =1 and the Status = "Open" then the
Label1.backcolor=Red
Position ID =2 and the Status = "Open" then the
Label2.backcolor=Red
Position ID =3 and the Status = "Close" then the
Label3.backcolor=Blue
Position ID =4 and the Status = "Cancelled" then the
Label4.backcolor=Green
.....

Do I need to use for Loop? how? Please teach me. Thanks in advance

Hi Michael,

Not sure if I'm exactly grasping your question, but it *sounds* like
you want to make a clone of the recordset behind your subform, and loop
through that to work out the statuses of your records and determine the
colors of your labels.

You can read a little more about RecordSetClone here:

http://msdn.microsoft.com/library/de...rdsetClone.asp

Others may have better suggestions...

Regards,

pt
Oct 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.