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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

allert when duplicated data is posted 1

Status
Not open for further replies.

kennetha

Programmer
Sep 10, 2003
105
0
0
MT
Hi,
I'm building a database for a friend of mine who owns a tool hiring shop.

I've create tables and forms (all unbounded objects) which update by DAO.I've stuck with a problem and cannot figure it out.
Table fields are as follows:
clientid; tooolId; datePeriodFrom; PeriodTo

How can I allert the user when he tries to book a tool when it's already booked.
example;
this data is already stored in table field
client1 tool001 1-1-08 to 31-1-08.
new data to be posted
client2 tool001 23-1-08 to 10-2-08 should result in a warning

Thanks in anticipation
Kenneth Agius
 
If the desired date range is entered first, a combobox could be used to limit tool selection to those which are actually available.

Let them hate - so long as they fear... Lucius Accius
 
Straybullet,

Cannot do a combo since tool is selected first. ie before posting date periods. Some Vba suggestions appriciated

Thanks

 
One of these may suit:

Code:
strSQL="Select ID,Etc From tblBooked Where ToolID=" _
& Me.txtToolID & " And #" _
& Format(Me.txtHireStartDate,"yyyy/mm/dd") _
& "# Between HireStartDate And HireEndDate" 
Set rs=CurrentDB.OpenRecordset (strSQL)

Or DlookUp
Code:
InUse=DlookUp("ToolID","tblBooked","ToolID=" _
& Me.txtToolID & " And #" _
& Format(Me.txtHireStartDate,"yyyy/mm/dd") _
& "# Between HireStartDate And HireEndDate")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top