Validation on safe button on form

MatthewJapp

Registered User.
Local time
Today, 18:53
Joined
Nov 22, 2010
Messages
28
Hi there,

I have a form with a drop down control box with Actioned or Pending as selections. There is a save record button on the form.

How do I use validation to make sure either Actioned or Pending has been selected for this field on clicking the save? Maybe with a message to go back and enter the info?

Also, I have a subform below and want that to refresh the query each time the save button is pressed?

Any help will be greatly appreciated!!

Many Thanks,

Matthew - Manchester UK
 
how do you do that if you don't mind me asking?
 
also still the issue of refreshing the datasheet ... it's driving me nuts :o)
 
If the subform isen't linked to the combobox in a Master/child relationship then put this in the After_Update event of your combobox.

Code:
Private Sub NameOfCombo_AfterUpdate()
Me.NameOfSubformConteiner.Requery
End Sub

If your form is bound to a table or query the you validate controls in the Form_BeforeUpdate event.

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.NameOfCombo) Then
    MsgBox "Required Entry"
    Cancel = True
    Me.NameOfCombo.SetFocus
End If
End Sub

JR
 
Ah, I still can't get it to work :o(

Maybe I need to buy a book for dummies
 
Open the table in Design View, find the field in question, change the "Required" option to "Yes"

This is the simplest way, you don't need to use code for this
 

Users who are viewing this thread

Back
Top Bottom