|
-
Nov 8th, 1999, 11:10 PM
#1
Thread Starter
Addicted Member
I am using the following code to update records in an Access 97 Database:
Dim oWs As Workspace
Dim oDb As Database
Dim strSQL as string
UserID = List1.Text
Set oWs = Workspaces(0)
Set oDb = OpenDatabase("c:\temp\DB1.mdb")
strSQL = " INSERT INTO Table1 " _
& "(Field1) VALUES " _
& "('" & UserID & "');"
List2.AddItem List1.Text
oDb.Execute strSQL
oDb.Close
This works fine BUT, how can I do a check on Field1 in Table1 to make sure that a duplicate entry is not made ???
-
Nov 9th, 1999, 02:38 AM
#2
Junior Member
You can check if the entry already exists in the table1. if not, then execute the insert statement.
-
Nov 9th, 1999, 11:26 AM
#3
Guru
make it indexed with no duplicates to let Access do the backend work -- it is better that you do not have to issue 2 SQL statements against your database
-
Nov 9th, 1999, 12:06 PM
#4
Addicted Member
You can make this field as indexed. Change value to OK (No Duplicates).
------------------
smalig
[email protected]
smalig.tripod.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|