Sorry ..novice programmer here: I am trying to populate a table with given values below from a click event. I want to enter the values " 'the current StudentID', GCSE Maths, and an empty value to be completed later" into the StudentQualificationsAchieved table (fields StudentID, Qualification, Grade). I have adapted some code I have found (below) but I cannot get it to work. I would appreciate any help you can give. As you can see I am finding this difficult and may be barking up the wrong tree all together. My code below:
Private Sub cmdGenerateRecords_Click()
'SQL Query specific variables
Dim dbs As Database
Dim qdf As QueryDef
Dim strSQL As String
'Initialise database object
Set dbs = CurrentDb
strSQL = "INSERT INTO StudentQualificationsAchieved (studentID, Qualification, Grade) VALUES (studentID, 'GCSE Mathematics', ' ')"
Set qdf = dbs.CreateQueryDef("", strSQL)
Call qdf.Execute
End Sub
Private Sub cmdGenerateRecords_Click()
'SQL Query specific variables
Dim dbs As Database
Dim qdf As QueryDef
Dim strSQL As String
'Initialise database object
Set dbs = CurrentDb
strSQL = "INSERT INTO StudentQualificationsAchieved (studentID, Qualification, Grade) VALUES (studentID, 'GCSE Mathematics', ' ')"
Set qdf = dbs.CreateQueryDef("", strSQL)
Call qdf.Execute
End Sub