Updating field on Load

cdoyle

Registered User.
Local time
Today, 04:26
Joined
Jun 9, 2004
Messages
383
Hi,

I have on my form two text boxes, the first text box is unbound and calculates the values of the ID's from some combo boxes on the form.

=[combo1ID] & [combo2id] & [combo3ID]
so you end up with a number depending on what the combo is

example 123

In the afterupdate of this field, I have
Me.txt_combofield.Value = txt_combo

txt_combo is bound to a field in my table.

So as the user makes selections from the dropdowns, the first text box calculates the value, and then the value in the second text box is updated and stored in the table.

This works great, but I'm running into a problem

I have on the form close, a popup form that checks for duplicate combo values when they try and close the form.

So if 2 users create a combo of 123 from the dropdowns, it warns them that this combo has already been used.

They can update their selections from the popup form, but the problem I'm running into is, when they go back and open the main form again. The second text box was not updated, it will still say '123' even if they updated on the popup, and the new value should be '456'

I tried adding to my onLoad of the main form

Me.txt_combofield.Value = txt_combo

thinking it would refresh the second field, but it doesn't.

How can I make the form, as it loads to make sure the second text box matches the first?
 
Move your OnClose duplicate test to BeforeUpdate of the bound combo.
Cancel the update if it detects a duplicate.
 
Move your OnClose duplicate test to BeforeUpdate of the bound combo.
Cancel the update if it detects a duplicate.

I tried this, but it doesn't solve the problem, when the popup form appears that displays the duplicates. If they change it from there, it's not updating the bound field (2nd text box) on my main form.

So the next time the main form opens, it runs the check again and warns them that there is a duplicate since that field wasn't updated. Even tho, there is no longer a duplicate.
 
Is there a way to make the second text box refresh on form load and close, to make it update to the first text box?

If so, then that would solve my problem I think.
 
Anyone else have any ideas?
There has to be a way when the form loads, to make field B look at the value of field A and update itself to match.
 

Users who are viewing this thread

Back
Top Bottom