nmretd
Nov 8th, 1999, 10:10 PM
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 ???
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 ???