Required Field in a form

Scooter1959

New member
Local time
Today, 06:23
Joined
Oct 4, 2009
Messages
2
Hello All,

First thanks in advance in any and all help for a noob. New to Access. Do not understand any VBA yet and it is getting me. Saw lots of good advice here and thought I would try.

I have a form, "SalesTicket", that has a field, "PO_Number" that I want the end user to put ANYTHING. I do mean anything, but not leave it blank. If the field is blank, it needs to pop up a warning message that says" Purchase Order # is required".

I am currently using a print macro button to do a bit.

macro.jpg


The Run Code command runs a Public Function that makes a new record and assigns a "ticket number".

I truly appreciate any and all assistance.

Thanks,

Scooter 1959
 
Last edited:
In your table properties put

Validation Rule: [PO_Number] Is Not Null
Validation Text: "Purchase Order # is required"

THis should get there without code...
 
Hello,

In my code, I have a ctl.Value = Null, doing the above in the table causes errors and does not work in the form field either.

Any other ideas?

Thanks again for any and all assistance

Scooter 1959
 
Code:
    If IsNull(Me.TextBox) Then
  MsgBox "A value is required for ..."
  Me.TextBox.SetFocus
  Cancel = True
End If

Funny Thing - Was just reading a doc about comboboxes and came across this.....!

Form BeforeUpdate Event BTW
 

Users who are viewing this thread

Back
Top Bottom