Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mark records to keep track

Status
Not open for further replies.
Mar 24, 2004
13
0
0
US
A form is populated with fields of a selected record from another table. I would like to mark the record by changing the font color to keep track of which records have been selected and which ones have not. I select the records through a combo box.

My form has 6 controls. All of them are populated from the table except for one. When the form is opened the focus is set to this text box. I have a procedure on the onchange as follows:

Private Sub GalsUsed_Change()
If Not IsNull(Me.GalsUsed) Then
Me.LineName.Value ForeColor = vbRed
End If
End Sub

This works, except that it changes all the records to red instead of the selected record. Please help.
 
You will have to re-post your explanation as I just do not understand what you are trying to achieve.

"Life is full of learning, and then there is wisdom"
 

I may not understand your question/problem completely and I hate to state the obvious but ...

Do you have any code to change the color back to the original color? Once you change the color in a control it stays that way until you change it or unload and reload the form.

What fun is a technology if you can't crash the OS?
 
Do you mean this

Private Sub GalsUsed_Change()
If Not IsNull(Me.GalsUsed) Then
Me.LineName.Value ForeColor = vbRed
else
Me.LineName.Value ForeColor = vbWhite
End If
End Sub
 
Yeah. If you don't set the color back then it will always be red after the first time it is changed.

I am still a little confused about the exact situation but that's my first guess.


Cheers,
Net_Giant

What fun is a technology if you can't crash the OS?
 
What I am basically trying to do is to flag the records on the detail table to keep track of which ones I have changed. I hope this helps.
 
Hmm. I'm starting to get a better understanding of your problem. Let me ask you a few questions to clarify the picture.

1) Are you populating the controls manually or are you using data binding?
2) How do you keep track of which detail records have been changed? Detail table column? In memory flag somewhere?



Net_Giant

What fun is a technology if you can't crash the OS?
 
I have two tables. Detail table and treatment table.

The form is a data entry form for the treatment table. The detail table is basically a template so-to-speak. I have one combo box which row source is from a field on the detail table. When I select a record from the combo box drop down list it automatically fills in the rest of the controls on my data entry form, except for one. I input the data to this control. Each record from the detail table has to be added only once a month to my treatment table with my data entry form. I want the font for the records already added from the detail table change to red as I added them, so I wont try to add them again, and so I can see which ones still need to be added to my treatment table.

I'm apologize if I have confused you. This is my first time posting a question. Thanks for your patience.
 
How do you know if a detail record has already been added to the treatment table this month?


Net_Giant

What fun is a technology if you can't crash the OS?
 
That is what I am trying to do. I want the record flagged or font color changed to distinguish an added record from one that has not been added.

 
OK. Let me ask that question a different way ...

Suppose you run the app, add a few records, close the app and then run the app again. How can you tell what records were added when you ran the app before?



Net_Giant

What fun is a technology if you can't crash the OS?
 
Can't you assign a field in the table to log the insertion date/month or whatever of the record when its done. I might be getting it wrong, but presumably table one contains all patient or whatever details, and table two is related to table one (foreign key), ie a master table record having multiple child records. If that the case then a simple date log in the child table would work. You could then query it so that each time you looked at the parent record, it would show the last child entry entered. Maybe I have got it wrong, but just hope it makes it that bit clearer as to what you are doing. Regards
 
You guys are on the right track. I just think I am asking for something impossible. I did however come up with another idea. I am afraid I will need your help. I don't do much programming. Here it goes.

I decided to add a new field on my detail table and make it a (yes/no) field. Now going back to the form that I created for my treatment table, I would like an event procedure for the AfterUpdate of my last control (the one I type data into) to add a check to my detail table (yes/no) field.
I think I would need an sql UPDATE statement, but I don't know the correct syntax.

By the way, thank you for helping!
 
It worked! I figured out the code. My form now adds a checkmark to my yes/no field with the onchange event of my text box. Thank you guys for helping.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top