Hey guys, I have an error in my Validation Rule Property... I get this error everytime I enter the Reservation Number (autonumber) into the field, to grab the Customer ID.
"The macro or function set to the beforeupdate or validationrule property for this field is preventing access from saving the data in the field"
I have nothing the the BeforeUpdate for this field, the validation rules is:
CheckResNo()=True
I only have 11 Reservations in the table... If I put "12" into the ResNoField it will say "Reservation Number Not Found" but 11 brings up the error above.
DataFill3:
Thanks for the help guys!

"The macro or function set to the beforeupdate or validationrule property for this field is preventing access from saving the data in the field"
I have nothing the the BeforeUpdate for this field, the validation rules is:
CheckResNo()=True
I only have 11 Reservations in the table... If I put "12" into the ResNoField it will say "Reservation Number Not Found" but 11 brings up the error above.
Code:
Function CheckResNo() As Boolean
Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Dim RNO As Integer
Dim RetValue As Boolean
RNO = Forms("Reservation")!ResNoField
RetValue = False
Set db = CurrentProject.Connection
Set rs = New ADODB.Recordset
rs.Open "Select * From Customer Inner Join Reservation on Customer.CustomerID=Reservation.CustomerID Where Reservation.ResNo=" & RNO, db
If Not rs.EOF Then
Call DataFill3(rs)
RetValue = True
Cancel = vbCancel
Forms("Reservation")!ResNoField.Undo
End If
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
CheckResNo = RetValue
End Function
Code:
Sub DataFill3(rs As ADODB.Recordset)
Dim fs As FileSystemObject
Set fs = New FileSystemObject
Forms("Reservation")!Rents.Enabled = True
Forms("Reservation")!NewRadio.Enabled = True
Forms("Reservation")!NewRadio.Value = 2
Forms("Reservation")!CustIDField.Enabled = True
Forms("Reservation")!SearchButt.Enabled = True
Forms("Reservation")!ResNoField = rs!ResNo
Forms("Reservation")!CustIDField = rs!CustomerID
Forms("Reservation")!FirstNameField = rs!FirstName
Forms("Reservation")!LastNameField = rs!Lastname
Forms("Reservation")!TelephoneField = rs!TelNo
Forms("Reservation")!StreetField = rs!Street
Forms("Reservation")!CityField = rs!City
Forms("Reservation")!ZipField = rs!Zip
Forms("Reservation")!StateField = rs!State
Forms("Reservation")!EmailField = rs!Email
Forms("Reservation")!PicIDField = rs!PicID
If fs.FileExists(rs!PicID) Then
Forms("Reservation")!PicID.Picture = rs!PicID
Else
Forms("Reservation")!PicID.Picture = "c:\default.jpg"
End If
End Sub


Last edited: