G
Guest
I want a make table query to execute when a user opens a certain form. I have
the following code in the Form_Open Event. (Notes: "TW" Tables in my DB are
those created by Make Table queries.
___________________________
Private Sub Form_Open(Cancel As Integer)
' Create TW Table for Unique Years for PplOrg
'Variable to store SQL
Dim YrSQL As String
YrSQL = "SELECT TAbb_PplOrg.OrgID, TAbb_PplOrg.ForYear,
Count(TAbb_PplOrg.PersonID) AS CountOfPersonID " + _
"INTO TWc_PplOrgYrs " + _
"FROM TAbb_PplOrg " + _
"GROUP BY TAbb_PplOrg.OrgID, TAbb_PplOrg.ForYear;"
' Turn off warnings and execute
DoCmd.SetWarnings False
DoCmd.RunSQL YrSQL
DoCmd.SetWarnings True
End Sub
_______________________
When I attempt to open the Form I get "Run-time error '3211' ": ... could
not lock table 'TWc_PplOrgYrs' because it is already in use by another person
or process."
Anyone see what's wrong?
Thanks - John D
the following code in the Form_Open Event. (Notes: "TW" Tables in my DB are
those created by Make Table queries.
___________________________
Private Sub Form_Open(Cancel As Integer)
' Create TW Table for Unique Years for PplOrg
'Variable to store SQL
Dim YrSQL As String
YrSQL = "SELECT TAbb_PplOrg.OrgID, TAbb_PplOrg.ForYear,
Count(TAbb_PplOrg.PersonID) AS CountOfPersonID " + _
"INTO TWc_PplOrgYrs " + _
"FROM TAbb_PplOrg " + _
"GROUP BY TAbb_PplOrg.OrgID, TAbb_PplOrg.ForYear;"
' Turn off warnings and execute
DoCmd.SetWarnings False
DoCmd.RunSQL YrSQL
DoCmd.SetWarnings True
End Sub
_______________________
When I attempt to open the Form I get "Run-time error '3211' ": ... could
not lock table 'TWc_PplOrgYrs' because it is already in use by another person
or process."
Anyone see what's wrong?
Thanks - John D