Bill Bisco
Active Member
- Joined
- Aug 8, 2007
- Messages
- 446
I have a subform which is tied to a query and on this subform there is a button which when pressed is supposed to change the query on this subform.
Here is my code for the button
Now, when I click the button, I don't receive any error messages, and I believe the code has run, but visually I can tell that the Query has not changed. I have tried refreshing the form as well as exiting out and opening it back up. However, the Query SQL has not changed.
Does anyone have any ideas?
Sincerely,
Bill
Here is my code for the button
Code:
Private Sub cmdMoveProcessOff_Click()
Dim dbsCurrent As Database
Dim qryName As QueryDef
Dim strSQL As String
Set dbsCurrent = CurrentDb
Set qryName = dbsCurrent.QueryDefs("qryProcessSelectLSSubform")
strSQL = "SELECT tblProcesses.[Process Name], tblProcesses.ProcessSEQ, tblProcesses.StationID, tblStations.[Station Name], tblStations.Side, tblStations.StationSEQ, tblZones.[Zone Name], tblZones.ZoneSEQ, tblProcesses.Time, tblProcesses.ProcessType, tblProcesses.ProcessSubType, tblZones.LineSpeed, tblStations.StationID, tblStations.StationSide, Sum(tblElements.ElementTime) AS SumOfElementTime"
strSQL = strSQL & "FROM tblZones INNER JOIN (tblStations INNER JOIN (tblProcesses INNER JOIN tblElements ON tblProcesses.[Process ID] = tblElements.[Process ID]) ON tblStations.StationID = tblProcesses.StationID) ON tblZones.[Zone ID] = tblStations.[Zone ID]"
strSQL = strSQL & "GROUP BY tblProcesses.[Process Name], tblProcesses.ProcessSEQ, tblProcesses.StationID, tblStations.[Station Name], tblStations.Side, tblStations.StationSEQ, tblZones.[Zone Name], tblZones.ZoneSEQ, tblProcesses.Time, tblProcesses.ProcessType, tblProcesses.ProcessSubType, tblZones.LineSpeed, tblStations.StationID, tblStations.StationSide;"
'qryName.SQL = strSQL
strSQL = qryName.SQL
End Sub
Does anyone have any ideas?
Sincerely,
Bill