J
jonathansnyder via AccessMonster.com
HI folks,
Im trying to run a make-table query via docmd.runsql within en event
procedure. I get a compile error on the SQL statement with the word "SELECT"
highlited. I copied the SQL statement directly from the query. I suspect
this is the problem.
Here is my code: Explanation of what code is supposed to do follows:
Private Sub cmdclose_Click()
On Error GoTo Err_cmdclose_Click
Dim strSQL As String
strSQL = SELECT TblMTRPVillage.Village, QryPBtaggerTotalByVillage.
CountOfTagger_ID AS PB_Total, QrySeotTaggerTotalByVillage.CountOfTagger_ID AS
SEOT_Total, QryWalrTaggerTotalByVillage.CountOfTagger_ID AS Walr_Total INTO
tblMTRPTaggersByVillage IN 'M:\MMM_SHAR\DATA\Alaska.mdb'FROM ((TblMTRPVillage
LEFT JOIN QrySeotTaggerTotalByVillage ON TblMTRPVillage.Village =
QrySeotTaggerTotalByVillage.Village) LEFT JOIN QryWalrTaggerTotalByVillage ON
TblMTRPVillage.Village = QryWalrTaggerTotalByVillage.Village) LEFT JOIN
QryPBtaggerTotalByVillage ON TblMTRPVillage.Village =
QryPBtaggerTotalByVillage.Village;
If Upd = 1 Then
DoCmd.RunSQL (strSQL)
DoCmd.Close
Else: DoCmd.Close
End If
Exit_cmdclose_Click:
Exit Sub
Err_cmdclose_Click:
MsgBox Err.Description
Resume Exit_cmdclose_Click
End Sub
UPD is a public variable declared in a module, on form open UPD is set to 0,
if a record is updated UPD is set to 1
I want to run a make-table querey when the user closes the form if any record
has been updated. The table created is then used in an ARC GIS project.
Thanks in Advance
Jonathan
Im trying to run a make-table query via docmd.runsql within en event
procedure. I get a compile error on the SQL statement with the word "SELECT"
highlited. I copied the SQL statement directly from the query. I suspect
this is the problem.
Here is my code: Explanation of what code is supposed to do follows:
Private Sub cmdclose_Click()
On Error GoTo Err_cmdclose_Click
Dim strSQL As String
strSQL = SELECT TblMTRPVillage.Village, QryPBtaggerTotalByVillage.
CountOfTagger_ID AS PB_Total, QrySeotTaggerTotalByVillage.CountOfTagger_ID AS
SEOT_Total, QryWalrTaggerTotalByVillage.CountOfTagger_ID AS Walr_Total INTO
tblMTRPTaggersByVillage IN 'M:\MMM_SHAR\DATA\Alaska.mdb'FROM ((TblMTRPVillage
LEFT JOIN QrySeotTaggerTotalByVillage ON TblMTRPVillage.Village =
QrySeotTaggerTotalByVillage.Village) LEFT JOIN QryWalrTaggerTotalByVillage ON
TblMTRPVillage.Village = QryWalrTaggerTotalByVillage.Village) LEFT JOIN
QryPBtaggerTotalByVillage ON TblMTRPVillage.Village =
QryPBtaggerTotalByVillage.Village;
If Upd = 1 Then
DoCmd.RunSQL (strSQL)
DoCmd.Close
Else: DoCmd.Close
End If
Exit_cmdclose_Click:
Exit Sub
Err_cmdclose_Click:
MsgBox Err.Description
Resume Exit_cmdclose_Click
End Sub
UPD is a public variable declared in a module, on form open UPD is set to 0,
if a record is updated UPD is set to 1
I want to run a make-table querey when the user closes the form if any record
has been updated. The table created is then used in an ARC GIS project.
Thanks in Advance
Jonathan