Check values before form update

M

Mr. Smith

Hi
In a combo box I have all clients listed. When a client is selected all
client info are retrieved from the database, and presented in aprox. 9
subforms. The user are enabled to change several values on clients, but it's
of course crucial that the client is consistent befor a new client is
selected.

I want to use the Before_Update statement in my combo box to check that
sform2_val1 = sform2_val1

Psaudo like this:
Sub cboClients Before_Update
If sform2_val1 = sform2_val1
MOVE TO SELECTED CLIENT
Else
STAY ON SAME CLIENT
End if
End sub

What would be the most efficient way to implement this little consitancy
check?

Mr. Smith
 
P

Pavel Romashkin

Sub cboClients Before_Update
If Me.Form.sform2.val1 <> Me.Form.sform2.val1 Then
MsgBox "Client information needs corrections."
Cancel = True
Exit Sub
End if
End sub

This assumes that Val1 is the name of a control on Sform1 and Sform2.
Pavel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top