DefaultValue Combobox entry/carryover to Subsequent Records

KyleB

Registered User.
Local time
Today, 09:04
Joined
Sep 14, 2001
Messages
71
I'm attempting to give a Combobox selection, that I want carried over to subsequent records. However if I try to do this in Current, or OnExit etc
Me.Shifter.DefaultValue = Me.Shifter
I either get errors, or invalid values. Dates carry over to the default value option within properties, but print in the form as times instead. I've tried several variations on this etc, but nothing seems to be working right. It seems simple enough, just to allow an entry from a combo box, and carry that to the next record, or if an entry exists in the previous record (which will pretty much always be true) then just query this field from last record and carry it to the next one, but still allow a change if needed.

I've considered DLookup as well, but how do I query current record # and then look at previous record number and corresponding box?

Kyle B.

[This message has been edited by KyleB (edited 09-18-2001).]
 
If you have a combo box named Combo3 then use code similar to this in the After Update event:

Private Sub Combo3_AfterUpdate()
Me![Combo3].Tag = Me![Combo3].Value
End Sub

In the On Enter event use code like this:

Private Sub Combo3_Enter()
If Not (IsNull(Me![Combo3].Tag) Or Me![Combo3].Tag = "") Then
Me![Combo3].Value = Me![Combo3].Tag
End If
End Sub

This code only works when you enter data and then continue to enter more records. If you close the form and come back to a new record it will not carry forward the data the you put in previously. You will need to make a selection again and then it will carry forward during that episode with the form... Hope that made sense!
 
Ok, that sort of does what I'm looking for, though I had to modify the If statement somewhat. The current configuration would over-write existing values if you scroll backward through the records, so I just nested it within another If statement that checks to see if the cell is occupied in which case it does nothing. Unfortunately this only works if the cell you are carrying is the current one, and that cell is carried over to successive records, but if you're changing multiple cells nothing happens to them, they remain blank.

Kyle B.

Ahh, solved the problem. Rather than in the On Enter event, I included the if Statements in the On Current event, so they all get called when the new record is first opened, and the values carry just fine then. Thanks for the help though, you got me pointed in the right direction at least.

[This message has been edited by KyleB (edited 09-19-2001).]

[This message has been edited by KyleB (edited 09-19-2001).]
 

Users who are viewing this thread

Back
Top Bottom