473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Duplicate Data

I have a form in Access which has event date and then also an event time slot such as "Morning, Afternoon, Evening" . I need to make it so that you cannot have a duplicate time booking, i assume i will need to code some VBA but if anyone could tell me what it would be much appreciated. Thanks
Apr 30 '06 #1
5 1578
CaptainD
135 100+
Look into using "Not In" in your where clause.

Select somedata from sometable where somefield NOT IN(Select DataYouDontWant)
Apr 30 '06 #2
thanks, care to elaborate? not exactly a VB expert....
Apr 30 '06 #3
CaptainD
135 100+
Not really VB or VBA but in your SQL query that will pull the information from your database. If you post how your table are layed out we can assist you with how to create the select statement to get the information you are looking for.

Using "Not In(Select statement)" is a way to filter the information you want. In your case, you don't want information that matches what you are setting up or open dates in a select time span. so in your case, it would be "Select Dates and times from YourTable where Date and time not in (select ThisDate, ThisTime)" or something along those lines.
Apr 30 '06 #4
thanks, i have two tables. THe first of which is just contact information and is named CustomerDetails, it is autoincrementing and that number is linked into the BookingDetails Table. THis contains the fields Event Date, and Event Time Slot which only allows the values of Morning, Afternoon and Evening.

The form contains a date input field and a event slot which is a drop down box, there is then a save record button to add this data to the tables.

thanks alot
Apr 30 '06 #5
cweiss
36
This may be oversimplifying it, but in your BookingDetails, why not just make EventDate and EventTime the primary key? Then they'll just get a warning if they try to add a time slot that's already taken.

Otherwise, you could use validation or SQL like CaptainD suggested. Validation would just give them a warning message if they entered a value that wasn't permissible (i.e. Time slot is taken, please select another time); or you could restrict the values they can choose from by putting a SQL statement in the Data Source property.
Apr 30 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Lowell Kirsh | last post by:
I have a script which I use to find all duplicates of files within a given directory and all its subdirectories. It seems like it's longer than it needs to be but I can't figure out how to shorten...
2
by: Pablo | last post by:
Hello, there, I have a table tblData which has pharmacy data. The table has following fields: ClaimNum, LineNum... The ClaimNum has claim number which is 12 characters. LineNum is NULL. The...
2
by: Brad Allison | last post by:
I have created a short routine to read certain data from an AS400 and put it into a small table stored in Access (I know not the best data store, but it is what we have for now). Anyway, some of...
6
by: sara | last post by:
I have a procedure to automate bringing several Excel files into our Access tables, on a daily basis. The problem is that if the user has a problem, and tries to run the import again (maybe 3...
2
by: news | last post by:
I just upgraded to PHP 4.4.2 on my Slackware 10.2 system. And Apache/mySQL/PHP all work great through a browser. No errors. But when I try to run a PHP script through the command line, which I...
5
by: Manish | last post by:
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone |...
4
by: FangQ | last post by:
hi I am very new to mysql. I have a question about using the "on duplicate update" clause with insert command. my table "data" has two columns, field1 and field2, where field1 is the index...
2
by: Harry Haller | last post by:
I want to duplicate the form data, edit it to remove some items (such as __EVENTTARGET, __EVENTVALIDATION, etc) and save it to a log. How can I make a duplicate (editable) copy of the Form...
1
by: oaklander | last post by:
I would like to make sure there are no duplicate data entries in my Oracle 9i table (called MainTable) which has an Id field that is the primary key, ValData with a varchar data type, Fid and Fid2...
4
by: Thomas Arthur Seidel | last post by:
Hello to all, I have a small or big problem with a customer data base, where during a change of system we might have created duplicate records. This should be easy to find, you might think, but,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.