Check if new vaule is primary key

Arshan

New member
Local time
Today, 08:57
Joined
Jul 21, 2009
Messages
5
Hi all

Thanks to some help from here I have
Code:
Dim SQLstrg As String
strSQL = "Insert Into tbllabeltable ([pltLabel#], [snItemNumber#], [pltProduct FamilyOne], " & _
         "[pltProduct FamilyTwo], [pltProduct FamilyThree], [pltBarCodeInfo], " & _
         " [pltProduct DescriptionOne], [pltProduct DescriptionTwo])  " & _
         "Values ('" & NewLabelNumber & "', '" & newItemCode & "', '" & copya & "', " & _
         "'" & copyb & "', '" & copyc & "', '" & copyd & "', '" & copye & "', '" & copyf & "')"
CurrentDb.Execute (strSQL)

One last small question: Is there a way to test NewLabelNumber and NewItemCode to make sure there isn't another vaule of the same name already in the table for them since they are both primary keys?

Thank you.
 
Put error handling in your procedure and change your code to:
CurrentDb.Execute strSQL, dbFailOnError
 

Users who are viewing this thread

Back
Top Bottom