954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Insert ignore

hi how to do insert ignore in access? is access support this function?

CurrentDb.Execute "INSERT IGNORE INTO FullDB (IDProc, IDOp, IDTech) VALUES (" & IDProct & "," & IDOpt & "," & IDTecht & ")"


or how can i do a search for duplicate record first before insert?

thanks

isumasama
Newbie Poster
18 posts since Feb 2006
Reputation Points: 11
Solved Threads: 0
 

after trying too many times yesterday, i dont think MS Access support INSERT IGNORE.
what i did instead is:
1. get the count for the particular record.. if there's record then >0
2. use the if statement before inserting any record.

dim temp as string

'1.
temp = DCount("ID", "FullDB", "IDProc = " & IDProct & "AND IDOp = " & IDOpt & "AND IDTech = " & IDTecht & "")

'2.
If temp = 0 Then
    CurrentDb.Execute "INSERT INTO FullDB (IDProc, IDOp, IDTech) VALUES (" & IDProct & "," & IDOpt & "," & IDTecht & ")"
   
ElseIf temp > 0 Then

MsgBox "The record you try to add is already exists. Please refill the form.", vbExclamation

End If
isumasama
Newbie Poster
18 posts since Feb 2006
Reputation Points: 11
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: