Created
June 10, 2013 14:51
-
-
Save janikvonrotz/5749338 to your computer and use it in GitHub Desktop.
MSAccess: Create Foreign Key
#VisualBasic
#MSAccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub VerweisErstellen(TableVerw As String, IDSource As String, IDSourceValue As Integer, IDDest As String, IDDestValue As Integer) | |
Dim db As DAO.Database | |
Set db = CurrentDb | |
'Delete of all Register data in link table | |
db.Execute "DELETE * FROM " & TableVerw & " WHERE " & IDSource & " = " & IDSourceValue, dbFailOnError | |
'Link the Register to the selected value | |
db.Execute "INSERT INTO " & TableVerw & " (" & IDSource & "," & IDDest & " ) VALUES(" & IDSourceValue & ", " & IDDestValue & ")" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment