This code works already
Code:
'set up a connection to the database
Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection
'set up a recordset
Dim myRS As New ADODB.Recordset
myRS.ActiveConnection = cnn1
'create query based on the sama tabel to which the subform is bound
'use data form the main form to filter the related data
Dim mySQL As String
mySQL = "SELECT Boekingen_setlist.BoekingID, Bands_Setlist.Titel, Bands_Setlist.Uitvoerder, Bands_Setlist.[Genre/versie], Bands_Setlist.[duur van het werk]FROM Boekingen_setlist INNER JOIN Bands_Setlist ON Boekingen_setlist.Titel = Bands_Setlist.[Setlist-ID]WHERE (((Boekingen_setlist.BoekingID)=" & Me.Boeking_ID & "))"
'open a recordset based on the query just created
myRS.Open mySQL
'check te make sure the recordset has records in it
If myRS.BOF And myRS.EOF Then
MsgBox "No Related Data"
Exit Sub
End If
I already know how it works to fill Word Form Fields for one reccord
how do you manage multiple records into a Word document in a table
sorry for my english, it's google translate