Hi,
I have a serious speed problem when this form frmChangeOrders is loaded. Using this form, users can change the orders they have already made.
This is the relation between the tables:
tblCustomer tblOrders tblOrderlines tblProducts
----------- --------- ------------- -----------
CustomerId OrderId OrderlineId ProductId
CustomerId ProductId
Ordered(Yes/No)
ProductMainGroupId
This the code when the form is loaded:
--------------------------------------------------------
Private Sub Form_Load()
If (DCount("[OrderId]", "tblOrders", "Ordered = False AND Customername = Forms!frmLogon!Customername"
= 0) Then
DoCmd.Close acForm, "frmChangeOrders"
MsgBox "There are no open orders!"
Else
'Initialize a listbox with the products
Me!cboID.RowSource = "SELECT [tblProducts].[ProductId], " & _
"[tblProducts].[NameProduct], [tblProductes].[Price], " & _
"[tblProducts].[VAT] FROM tblProductMainGroup INNER JOIN " & _
"(tblProductGroup INNER JOIN (tblAnalytical INNER JOIN " & _
"tblProducts ON tblAnalytical.[Analytical code] = " & _
"tblProducts.[Analytical code]) ON tblProductGroup.ProductGroupCode = " & _
"tblAnalytical.ProductGroupNumber) ON tblProductMainGroup.MainGroupId = " & _
"tblProductGroup.MainGroupId WHERE ([tblProductMainGroup].[MainGroupId] =" & Me!ProductMainGroupId & "
"
End If
End Sub
---------------------------------------------------------
As you can see, there are only 2 main things happening when the form is loaded.
1) With DCount I check if there are open orders (orders that have not been confirmed yet and can still be changed)
2) I initialize a listbox to make sure it only contains the products that are allowed for this order (there are different kinds of orders)
Does anyone have an idea what is slowing down the loading of this form?
Thanks a lot in advance!
dj.
I have a serious speed problem when this form frmChangeOrders is loaded. Using this form, users can change the orders they have already made.
This is the relation between the tables:
tblCustomer tblOrders tblOrderlines tblProducts
----------- --------- ------------- -----------
CustomerId OrderId OrderlineId ProductId
CustomerId ProductId
Ordered(Yes/No)
ProductMainGroupId
This the code when the form is loaded:
--------------------------------------------------------
Private Sub Form_Load()
If (DCount("[OrderId]", "tblOrders", "Ordered = False AND Customername = Forms!frmLogon!Customername"
DoCmd.Close acForm, "frmChangeOrders"
MsgBox "There are no open orders!"
Else
'Initialize a listbox with the products
Me!cboID.RowSource = "SELECT [tblProducts].[ProductId], " & _
"[tblProducts].[NameProduct], [tblProductes].[Price], " & _
"[tblProducts].[VAT] FROM tblProductMainGroup INNER JOIN " & _
"(tblProductGroup INNER JOIN (tblAnalytical INNER JOIN " & _
"tblProducts ON tblAnalytical.[Analytical code] = " & _
"tblProducts.[Analytical code]) ON tblProductGroup.ProductGroupCode = " & _
"tblAnalytical.ProductGroupNumber) ON tblProductMainGroup.MainGroupId = " & _
"tblProductGroup.MainGroupId WHERE ([tblProductMainGroup].[MainGroupId] =" & Me!ProductMainGroupId & "
End If
End Sub
---------------------------------------------------------
As you can see, there are only 2 main things happening when the form is loaded.
1) With DCount I check if there are open orders (orders that have not been confirmed yet and can still be changed)
2) I initialize a listbox to make sure it only contains the products that are allowed for this order (there are different kinds of orders)
Does anyone have an idea what is slowing down the loading of this form?
Thanks a lot in advance!
dj.