Thanks in advance for your help. It is greatly appreciated!
Two part question. But the first question needs to be addressed before I can move on the second one.
I have a bound Datasheet Form. Technically, it’s a Subform in a Form that just holds a Heading Label.
I use FormatConditions to change colors. The Code was always located in the On Load Event. The values to change the colors were Hard Coded in the Load event. It’s always worked fine.
I decided to add flexibility to the Form. I needed to make the Values reside in a Variable, instead of being Hard Coded.
I have that working fine.
Then, I added a separate lookup table to hold a ProductType with an associated value. It’s a simple two column table.
ProductType and Vlaue. The value acts as a standard for the Product Type.
I added a ComboBox Column to the Datasheet Form.
I open up a recordset of the Lookup table (ProductType) with a select Statement and a Where Clause to find the exact match for the Datasheet Lookup ComboBox. I move the ProductType value from the lookup to the Variable in the FormatConditions Code, to determine the color that will be displayed on the form.
When the code is in the Load Event, only the first record gets the correct color and the rest of the records seem to follow that value that was placed in the Variable when the recordset, Select, Where Clause finds the looked up ProductType value. The rest of the records have the wrong colors based on their ComboBox ProductType on the Datasheet according to the value on the forms Datasheet record. Basically the DataSheet Form has a value you set and the ComboBox ProductType represents the standard value for that ProductType. The Colors are set to make it easy to see if the value on the record is at or below the Products standard.
Can someone help me understand how I get every record that the Datasheet Forms will Display to be evaluate against the Recordset lookup, so that each record in the Datasheet, will display with the correct color.
Additionally, and I don’t want to muddy thing up, but I don’t want to be opening the recordset every time I do a lookup.
I want to open it once, leave it open and do the lookup for every record. I have looked into this and I can’t seem to get it to work. All this credit below belongs to Michael Kaplan https://groups.google.com/forum/?hl=en#!topic/comp.databases.ms-access/AKNOQqL05iw[51-75]
Private m_db As DAO.Database
Public Property Get CurrentDbC() As DAO.Database
If (m_db Is Nothing) Then
Set m_db = CurrentDb
End If
Set CurrentDbC = m_db
End Property
I thought I could put this in the Open Event but it won’t compile cleanly. If anyone knows how to do this, I would appreciate your help.
Thanks again.
Two part question. But the first question needs to be addressed before I can move on the second one.
I have a bound Datasheet Form. Technically, it’s a Subform in a Form that just holds a Heading Label.
I use FormatConditions to change colors. The Code was always located in the On Load Event. The values to change the colors were Hard Coded in the Load event. It’s always worked fine.
I decided to add flexibility to the Form. I needed to make the Values reside in a Variable, instead of being Hard Coded.
I have that working fine.
Then, I added a separate lookup table to hold a ProductType with an associated value. It’s a simple two column table.
ProductType and Vlaue. The value acts as a standard for the Product Type.
I added a ComboBox Column to the Datasheet Form.
I open up a recordset of the Lookup table (ProductType) with a select Statement and a Where Clause to find the exact match for the Datasheet Lookup ComboBox. I move the ProductType value from the lookup to the Variable in the FormatConditions Code, to determine the color that will be displayed on the form.
When the code is in the Load Event, only the first record gets the correct color and the rest of the records seem to follow that value that was placed in the Variable when the recordset, Select, Where Clause finds the looked up ProductType value. The rest of the records have the wrong colors based on their ComboBox ProductType on the Datasheet according to the value on the forms Datasheet record. Basically the DataSheet Form has a value you set and the ComboBox ProductType represents the standard value for that ProductType. The Colors are set to make it easy to see if the value on the record is at or below the Products standard.
Can someone help me understand how I get every record that the Datasheet Forms will Display to be evaluate against the Recordset lookup, so that each record in the Datasheet, will display with the correct color.
Additionally, and I don’t want to muddy thing up, but I don’t want to be opening the recordset every time I do a lookup.
I want to open it once, leave it open and do the lookup for every record. I have looked into this and I can’t seem to get it to work. All this credit below belongs to Michael Kaplan https://groups.google.com/forum/?hl=en#!topic/comp.databases.ms-access/AKNOQqL05iw[51-75]
Private m_db As DAO.Database
Public Property Get CurrentDbC() As DAO.Database
If (m_db Is Nothing) Then
Set m_db = CurrentDb
End If
Set CurrentDbC = m_db
End Property
I thought I could put this in the Open Event but it won’t compile cleanly. If anyone knows how to do this, I would appreciate your help.
Thanks again.