Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing yes/no is true to bound control box is null

Status
Not open for further replies.

accesscaped

Technical User
Feb 28, 2003
1
US
I am doing an Access database to produce a class schedule. I have a form with a yes/no box called active to select desired courses. When active is checked(true)it needs to be compared to the bound control box period_id which can not be null. If it is null the record does not show up when I query all courses where active = yes. I have tried this code:

Private Sub Form_Close()
Dim InValidFlag As Boolean
Dim Message1 As String
Message1 = "Good"
InValidFlag = [Checkbox] And IsNull([period_id])
If InValidFlag = True Then Message1 = "Bad"
Msgbox (Message1)
End Sub

However, this only displays the message when I close the form and also does not tell the user which record is invalid. I want to check if active is true then period_id is not null if it is null a message pops up saying enter a period_id. I am a novice at Access so any help is greatly appreicated. Thank you in advance.
Allen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top