473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I get the record from subform?

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
2 1832

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: YFS DBA | last post by:
How do I use VBA to insert a *new* record into a subform? I have a master form with client information, and a sub form with billing information. I want to click on a button ("Add Data") and have...
0
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record...
5
by: Galina | last post by:
Hello A have an application in MS Access 2000. It has a form (courses), which has a subform (course occurrences), which has a subform (occurrence learning aims). The Learning aims subform is...
5
by: Mary Litten | last post by:
Hi - (This is my very first post) I have gotten to this point of registering to post because I have been spinning my wheels so long, I believe I am all caught up in the weeds. (and mud) I have...
1
by: sixsoccer | last post by:
I have built a database with a <Mainform> and a <Subform>. My problem is twofold. 1. My subform is set as a continuos form with AllowAddiotions set to NO (ie. a list of Issues to the client on...
6
by: Steve | last post by:
I have a form, primary subform and secondary subform. A tab control takes up all the area of the primary subform. There are about 15 tabs on the tabcontrol. Each tab contains fields from the same...
5
by: Bob | last post by:
Hi Everybody I have a form called frmListBox that is connected to a table tblListBox. This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder" and...
3
by: Maria | last post by:
Is there another way to delete the current record in a subform from the main form, another subform or a sub-subform other than setting focus on a field in the subform and using run command...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.