Please be explicit--what does this mean?
This is the file itself, the linking button is located in "cmdKoppelPaul", tblbestanden = tblfile
I also note that there are no relationships in your database.
This is the caption for cmdKoppelPaul Koppel alle bestanden
I'm looking/reviewing at the click event
Code:
Private Sub cmdKoppelPaul_Click()
Dim vDB As DAO.Database
Dim vRST As DAO.Recordset
Dim strSQLObject As String
Dim strSQLBestand As String
Set vDB = CurrentDb
strSQLObject = "SELECT * from tblobjecten order by objectnummer"
Set vRST = vDB.OpenRecordset(strSQLObject, dbOpenDynaset, dbSeeChanges)
vRST.MoveFirst
Do While Not vRST.EOF
strSQLBestand = "INSERT INTO tblobjectbestand (fldobjectid,fldbestandid)VALUES (1068, 688999)"
strSQLBestand = strSQLBestand & " SELECT " & vRST!objectid & ", fldbestandid FROM tblbestand where instr(fldbestand," & Chr(34) & vRST!Objectnummer & Chr(34) & ") >0"
'DoCmd.SetWarnings False
'DoCmd.RunSQL strSQLBestand
Debug.Print strSQLBestand
'CurrentDb.Execute strSQLBestand, dbFailOnError
vRST.MoveNext
Loop
End Sub
I tried using the debug.print output as a query to see if it would be accepted by Access.
Code:
INSERT INTO tblobjectbestand (fldobjectid,fldbestandid)VALUES (1068, 688999) SELECT 1068, fldbestandid FROM tblbestand where instr(fldbestand,"NB0001") >0
It fails saying no semicolon at the end, but I don't believe that's an issue(yet).
You would not need a VALUES and Select in the same query sql???
I am confused on what exactly is your intent with this code??????????????