Engr. Matthew
New member
- Local time
- Today, 23:51
- Joined
- Feb 27, 2021
- Messages
- 14
this is a Temp table I use in moving items from products table to Purchase Order Details table
Here is the code I use to fine product record:
Private Sub FindProductCode()
On Error GoTo FindProductCodeError
If IsNull(Code) Then
Code.TabStop = False
DoEvents
Else
Code.TabStop = True
'Use Domain lookup function to populate the text boxes
ProductName = DLookup("ProductName", "Products", "Code =" & Code)
ProductID = DLookup("ProductID", "Products", "Code =" & Code)
' QuantityPerUnit = DLookup("QuantityPerUnit", "Products", "Code =" & Code)
PPrice = DLookup("[Products].[PPrice]", "Products", "Code =" & Code)
Extended = Quantity * PPrice
Forms!Orders!txtDes = DLookup("Description", "Products", "Code =" & Code)
DoCmd.RunCommand acCmdSaveRecord
End If
Exit Sub
FindProductCodeError:
' MsgBox "No ID Found", vbOKOnly, "No Record Found"
Exit Sub
Me.Refresh
End Sub
---------------------
This code works fine. I noticed when data is large on a wireless network it takes longer time to find an item and users not been patient, their always try to click one thing on Access form as a result of the interruption Access stop responding. Is there other way I can organize the VBA code to run faster.
Here is the code I use to fine product record:
Private Sub FindProductCode()
On Error GoTo FindProductCodeError
If IsNull(Code) Then
Code.TabStop = False
DoEvents
Else
Code.TabStop = True
'Use Domain lookup function to populate the text boxes
ProductName = DLookup("ProductName", "Products", "Code =" & Code)
ProductID = DLookup("ProductID", "Products", "Code =" & Code)
' QuantityPerUnit = DLookup("QuantityPerUnit", "Products", "Code =" & Code)
PPrice = DLookup("[Products].[PPrice]", "Products", "Code =" & Code)
Extended = Quantity * PPrice
Forms!Orders!txtDes = DLookup("Description", "Products", "Code =" & Code)
DoCmd.RunCommand acCmdSaveRecord
End If
Exit Sub
FindProductCodeError:
' MsgBox "No ID Found", vbOKOnly, "No Record Found"
Exit Sub
Me.Refresh
End Sub
---------------------
This code works fine. I noticed when data is large on a wireless network it takes longer time to find an item and users not been patient, their always try to click one thing on Access form as a result of the interruption Access stop responding. Is there other way I can organize the VBA code to run faster.