473,386 Members | 1,962 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,386 software developers and data experts.

Import from Excel and prevent duplicate entries

547 512MB
I use this code to import into the RaceEntry tbl
Expand|Select|Wrap|Line Numbers
  1.     Dim strPath As String
  2.  
  3.  
  4.  
  5.     With Me
  6.          strPath = Left(.lblFile.Caption, InStrRev(.lblFile.Caption, "\"))
  7.         strPath = FSBrowse(strStart:=strPath, _
  8.                            lngType:=msoFileDialogFilePicker, _
  9.                            strPattern:="MS Excel,*.xls")
  10. If strPath > "" Then
  11.              .lblFile.Caption = strPath
  12.              MsgBox "Please be patient. All Race Entry Data is now imported into the program ", vbInformation, "Data imported"
  13.            Call DoCmd.SetWarnings(False)
  14.  
  15.               Call DoCmd.TransferSpreadsheet(acImport, acSpreadsheetTypeExcel9, "RaceEntry", strPath, True, "")
  16.  
  17.  
  18.  
  19.             Call DoCmd.SetWarnings(True)
  20.  
  21. End If
  22.      End With
In the RaceEntry table there are 2 "unique" fields namely RaceDate (shortdate field) and RaceNo (number field), that can be used to block duplicate data imports in combination, from an Excel spreadsheet. (both are set to accept duplications)

Ie Racenumber = 50 on RaceDate 31/10/2011, should only appear once in the RaceEntry tbl, but the RaceNumber may appear numerous times in combination with other dates.

A lot of my race entries come from online websites, and it is supplied in Excel format by the web administator. Having these validation checks will save a lot of time.

Is this possible?
Nov 17 '11 #1
2 3827
NeoPa
32,556 Expert Mod 16PB
Neels:
Is this possible?
If you mean "Is it possible to ensure that no duplicate data is entered into the table [RaceEntry]?" then the answer is yes, but you'd need to change the code to import into a temporary table first. Once the data is imported without any checks, the data in the temp table can be tested for validity. You can also report on any invalid data of course at this point, but valid data could then be copied across to your main table.
Nov 17 '11 #2
neelsfer
547 512MB
thx i will try that first.
Nov 18 '11 #3

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

Similar topics

1
by: Gary Lundquest | last post by:
It appears to me that MySQL version 4 returns an error messge when doing an Insert that results in duplicate entries. Version 3 did NOT return an error - it dropped the duplicate entries and ran...
3
by: andreas.maurer1971 | last post by:
Hi all, since a few years I use the following statement to find duplicate entries in a table: SELECT t1.id, t2.id,... FROM table AS t1 INNER JOIN table AS t2 ON t1.field = t2.field WHERE...
4
by: sri2097 | last post by:
Hi all, I'm storing number of dictionary values into a file using the 'cPickle' module and then am retrieving it. The following is the code for it - # Code for storing the values in the file...
5
by: Chris Lasher | last post by:
Hello Pythonistas! I'm looking for a way to duplicate entries in a symmetrical matrix that's composed of genetic distances. For example, suppose I have a matrix like the following: A B ...
5
by: Manish | last post by:
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone |...
12
by: joestevens232 | last post by:
Hello Im having problems figuring out how to remove the duplicate entries in an array...Write a program that accepts a sequence of integers (some of which may repeat) as input into an array. Write...
6
by: Arthur Dent | last post by:
Anyone know, in VB.NET (2005) how to prevent duplicate occurrences of the same event handler on an event? e.g... I have some object which raises an event, and some other class which consumes...
6
by: teser3 | last post by:
I have my PHP inserting into Oracle 9i. But how do I prevent duplicate record entries? I only have 3 fields in the insert in the action page: CODE <?php $c=OCILogon("scott", "tiger",...
7
by: php_mysql_beginer911 | last post by:
Hi .. i am trying to update a table where if field contents any duplictaed entries than one of the field should be updated with random number which is unique so i can make all entries unique i...
4
by: neelsfer | last post by:
Hi This code worked until i changed the "RaceNo" file to text from number format. What brackets or code should i change to make it work? This is to prevent duplicate entries. thx for helping...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.