Desperate for help- Age restrictions and checkboxes

HaymanLTD

New member
Local time
Tomorrow, 05:26
Joined
May 5, 2009
Messages
3
Hi, I am making a database for a small business that allows rental of tractors using Microsoft Access 2007.
I need help with a couple of codes for queries.
The first one is a code that restricts the user to make an applicant under the age of 18 with their date of birth from the Now() command. I have the date difference of years but I can't get it to show a validation message notifying the data entry applicant the person must be over 18 years of age.
The second code is one that if is not returned by the [due_date] it is then checked in a checkbox if so, is their an easier way to do this? if going from the checkbox how can I make the query search for checkboxes that are ticked? I have tried going from vb.net knowledge be adding: if (Checkbox_name) = True but this showed up as a 0 or -1. Unless this is the correct way, how can I make it say Yes if it is overdue or with the loan_date and due_dates that I have to automatically detect if it is overdue.

Cheers,
Greatly appreciate any help

HaymanLTD
 
the user to make an applicant under the age of 18 with their date of birth from the Now() command

Use Date() instead of Now(). Now() incorporates time as well as date. At 12noon Date() => xxxxxx whereas Now() gives xxxxx.5. This causes trouble when you are trying to filter between dates, the last day will not appear with Now() but does with Date().

Basically, as I am lazy, I use Int((DOB-Date())/365.25 to give me an age. It can be a max of 1 day out, but that is irrelevant for my needs. I would put in a MsgBox to give a warning msg.

eg
If intAge<18 Then
MsgBox("... Warning...)
Else
code
End If

"if (Checkbox_name) = True but this showed up as a 0 or -1. Unless this is the correct way, how can I make it say Yes if it is overdue or with the loan_date and due_dates that I have to automatically detect if it is overdue."

Iif((Checkbox_name),"Yes","No")
 
Thankyou WIS! this information solved the problem very much appreciated.

Cheers
HaymanLTD
 
hold on, I enter the code and im getting invalid syntax for Then and MsgBox
 

Users who are viewing this thread

Back
Top Bottom