PRMiller2
Technical User
- Jul 30, 2010
- 123
I'm getting pretty irritated with a problem that I cannot seem to solve. I've tried a number of different things with no luck. Please help!
I have two forms: the main form named frmApplyPriceSchedules and the subform called sfmAppliedPriceSchedules. They are NOT linked through a master/child relationship. When I load the main form, the subform is intentionally disabled. After updating combo box cboLOBGroupTier, two global variables are populated, the subform is enabled, and the subform should then be populated.
However, the subform does not want to requery. Here is the code for the main form's combo box after update event:
I have stepped through the code using the debugger and all lines do execute. However, it simply exits the sub after the line "me.requery" (and any of the varieties I have tried) without actually updating the subform. I have even tried requerying the main form, to no avail.
Here's the code in the Form_Load event of the subform:
As this is in development, I don't zero out the two global variables used to populate the recordsource query. As such, if I simply close the main form and reopen it, the subform then properly displays the records it should have shown when being requried initially.
I can't seem to figure out what's missing here. Any suggestions?
I have two forms: the main form named frmApplyPriceSchedules and the subform called sfmAppliedPriceSchedules. They are NOT linked through a master/child relationship. When I load the main form, the subform is intentionally disabled. After updating combo box cboLOBGroupTier, two global variables are populated, the subform is enabled, and the subform should then be populated.
However, the subform does not want to requery. Here is the code for the main form's combo box after update event:
Code:
Private Sub cboLOBGroupTier_AfterUpdate()
On Error GoTo Err_Handler
Dim strsql As String
glngQALOBGroupTierID = Me.cboLOBGroupTier.Column(0)
Me.sfmContainer.Enabled = True
Me.sfmContainer.Requery
Me.Requery
Exit_Handler:
Exit Sub
Err_Handler:
Call LogError(Err.Number, Err.Description, "frmApplyPriceSchedules.cboLOBGroupTier_AfterUpdate()")
Resume Exit_Handler
End Sub
I have stepped through the code using the debugger and all lines do execute. However, it simply exits the sub after the line "me.requery" (and any of the varieties I have tried) without actually updating the subform. I have even tried requerying the main form, to no avail.
Here's the code in the Form_Load event of the subform:
Code:
Private Sub Form_Load()
On Error GoTo Err_Handler
Dim strsql As String
If glngQAClientID > 0 And glngQALOBGroupTierID > 0 Then
strsql = "SELECT a.lonQAAppliedPriceSchedulesID_pk, c.txtQAPriceScheduleName, [b].[datStartDate] & '-' & [b].[datEndDate] AS ValidDates" & _
" FROM ((tblQAAppliedPriceSchedules AS a" & _
" LEFT JOIN tblQAPriceScheduleDetail AS b ON a.lonQAPriceScheduleDetailID_pk = b.lonQAPriceScheduleDetailID_pk)" & _
" LEFT JOIN tblQAPriceScheduleNames AS c ON b.lonQAPriceScheduleNamesID_fk = c.lonQAPriceScheduleNamesID_pk)" & _
" INNER JOIN tblQAClientsQALOBGroupTiers AS d ON a.lonQAClientsQALOBGroupTiersID_pk = d.lonQAClientsQALOBGroupTiersID_pk" & _
" WHERE (((d.lonQALOBGroupTierID_fk)=" & glngQALOBGroupTierID & ")" & _
" AND ((d.lonQAClientID_fk)=" & glngQAClientID & "));"
Me.RecordSource = strsql
Me.lblQAPriceScheduleName.ForeColor = 0
Me.lblValidDates.ForeColor = 0
Me.txtQAAppliedPriceSchedulesID_pk.ControlSource = "lonQAAppliedPriceSchedulesID_pk"
Me.txtQAPriceScheduleName.ControlSource = "txtQAPriceScheduleName"
Me.txtValidDates.ControlSource = "ValidDates"
End If
Exit_Handler:
Exit Sub
Err_Handler:
Call LogError(Err.Number, Err.Description, "sfmAppliedPriceSchedules.Form_Load()")
Resume Exit_Handler
End Sub
As this is in development, I don't zero out the two global variables used to populate the recordsource query. As such, if I simply close the main form and reopen it, the subform then properly displays the records it should have shown when being requried initially.
I can't seem to figure out what's missing here. Any suggestions?