Duplicating a value on another field when entered in form

maperou

Registered User.
Local time
Today, 15:44
Joined
Jun 23, 2014
Messages
10
Hi everybody,

I have a form that has two date combo boxes. I would like to have one of the combo boxes populate by itself with the same value the user enters in the other combo box. How do I do this?
Appreciate your help!
 
In the after update event of the first:

Me.SecondCombo = Me.FirstCombo
 
Thank you for responding pbaldy. I tried adding to the first combo box in the after update expression builder the code you sent me but it didn't work. When I go to enter the date in the first combo box I get an acess error: "The expression After Update you entered as the event property setting produced the following error: The object doesn't contain the Automation object 'me' ". Did I do something wrong?
Note that I would like to populate the first combo box with a date and have the second combo box populate by itself with the same date. I also want to be able to change the second combo box in the future when things change so I don't want this box to be locked.
 
pbaldy this is great! Thank you so much! The code worked!
 
Paul (pbaldy) may I ask you what's the code to temporarily lock a field until the user enters data in that field. So if the user wants to skip a field the system returns a message that he can't continue unless he enters the information on the field he's trying to skip.
Thanks!
 
Normally I'd use the before update event of the form:

http://www.baldyweb.com/BeforeUpdate.htm

If you want to go field by field, I'd probably lock or disable later controls until the control in question has been populated.
 
Hi Paul (pbaldy)

I have tried using the code you sent me for validating data before saving it but I can't make it work. I keep getting errors. This is what I wrote in VBA:

Private Sub Text111_BeforeUpdate()
If Len(Me.Text111 & vbNullString) = 0 Then
MsgBox "You need to add the Deal Overview before continuing"
Me.Text111.SetFocus
End Sub
First I got an error msg that said the field was blocked without an end if; so I added it but it didn't work as well. Later I was even unable to open the forml. I deleted the code and was able to open the form again
Any suggestions?
 
Well, it's not what I suggested but try

Code:
Private Sub Text111_BeforeUpdate()
  If Len(Me.Text111 & vbNullString) = 0 Then
    MsgBox "You need to add the Deal Overview before continuing"
    Cancel = True
  End If
End Sub

I don't like using the before update event of controls, because that won't fire if the user skips it.
 

Users who are viewing this thread

Back
Top Bottom