G
Guest
Hi,
I have the following code which is activated by a command butto
------------------------------------------------------------------------------------------------
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO [keyskill_comp] ( [Person Code], [Course Code]
) SELECT [learners courses].[Person Code], [learners courses].[Course Code]
FROM [learners courses] GROUP BY [learners courses].[Person Code], [learners
courses].[Course Code] HAVING ((([learners courses].[Person Code])=
[forms]![learners courses subform active]![Person Code]) and (([learners
courses].[Course Code])= [forms]![learners courses subform active]![Course
Code])); "
stDocName = "Result pop up"
stLinkCriteria = "[Person Code]=" & Me![person code] & " and [Course
Code]=" & "'" & Me![course code] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.SetWarnings True
-----------------------------------------------------------------------------------------------
The query and forms work perfectly when I view them as standalone forms.
However, I actually have the form with the button on it as a subform on a
main form. The query stops at the point where it should refer to the form,
to get the person code and course code, and asks me to enter my parameter
values Do I have to refer to it differently for a subform?
I have the following code which is activated by a command butto
------------------------------------------------------------------------------------------------
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO [keyskill_comp] ( [Person Code], [Course Code]
) SELECT [learners courses].[Person Code], [learners courses].[Course Code]
FROM [learners courses] GROUP BY [learners courses].[Person Code], [learners
courses].[Course Code] HAVING ((([learners courses].[Person Code])=
[forms]![learners courses subform active]![Person Code]) and (([learners
courses].[Course Code])= [forms]![learners courses subform active]![Course
Code])); "
stDocName = "Result pop up"
stLinkCriteria = "[Person Code]=" & Me![person code] & " and [Course
Code]=" & "'" & Me![course code] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.SetWarnings True
-----------------------------------------------------------------------------------------------
The query and forms work perfectly when I view them as standalone forms.
However, I actually have the form with the button on it as a subform on a
main form. The query stops at the point where it should refer to the form,
to get the person code and course code, and asks me to enter my parameter
values Do I have to refer to it differently for a subform?