Babycat
Member
- Local time
- Today, 16:20
- Joined
- Mar 31, 2020
- Messages
- 304
Hi everyone
Please help.
On my design:
1. Left-side: a continuous form (SubForm) that shows list of product
2 Right-side (on MainFrm) show product detail of selected product in left-side.
3. Modern chart to show price/qty over time of current product
4. SubForm, MainFrm bound to tblProduct
5. The MainFrm is opened from FormA by a button (attached picture)
Intention: When user clicks on a product row (on continuous form - SubForm) the MainFrm will show that product's detail.
Crash issue:
Happen when combobox = 2 or 3.
Not happend if combobox = 1 or we remove the modern Chart
Code on FormA to open selected productID (via form open argument)
Code on the SubForm
My suspect:
- On the FormA, user selected ProductID 2 to view
- MainFrm is loading its control and chart belong to productID 1 (by default sorting)
- at this the, subform forces MainFrm to show productID 2
- The chart of productID 1 is not finish loading yet, --> Access crashes
Please help.
On my design:
1. Left-side: a continuous form (SubForm) that shows list of product
2 Right-side (on MainFrm) show product detail of selected product in left-side.
3. Modern chart to show price/qty over time of current product
4. SubForm, MainFrm bound to tblProduct
5. The MainFrm is opened from FormA by a button (attached picture)
Intention: When user clicks on a product row (on continuous form - SubForm) the MainFrm will show that product's detail.
Crash issue:
Happen when combobox = 2 or 3.
Not happend if combobox = 1 or we remove the modern Chart
Code on FormA to open selected productID (via form open argument)
Code:
Private Sub Btn_ViewProduct_Click()
DoCmd.OpenForm "MainFrm", , , , , , Combo0 & ""
End Sub
Code on the SubForm
Code:
Private Sub Form_Current()
Dim rs As DAO.Recordset
Set rs = Me.Form.Parent.Form.Recordset
With rs
.FindFirst "[ProductID] = " & Txt_ID
If .NoMatch Then
MsgBox "Unknow Error - No ProductID " & ProductID & " !"
End If
End With
Set rs = Nothing
End Sub
Code:
Private Sub Form_Load()
Dim pID As Long
Dim argStr As String
Dim rs As DAO.Recordset
If Me.Parent.Form.OpenArgs & "" = "" Then '
'Dont need to go any record
Else
pID = Val(Me.Parent.Form.OpenArgs & "")
Set rs = Me.Recordset
With rs
.FindFirst "[ProductID] = " & pID
If .NoMatch Then
MsgBox "Unknow Error - No ProductID " & ProductID & " !"
End If
End With
Set rs = Nothing
End If
End Sub
My suspect:
- On the FormA, user selected ProductID 2 to view
- MainFrm is loading its control and chart belong to productID 1 (by default sorting)
- at this the, subform forces MainFrm to show productID 2
- The chart of productID 1 is not finish loading yet, --> Access crashes
Attachments
Last edited: