ChrisLeicester
Member
- Local time
- Today, 17:03
- Joined
- Feb 14, 2025
- Messages
- 30
Hi
Taking advice from here, I am trying to move away from Macro's and use more VBA, although it is a learning curve.
I have a main form with two subforms, one showing current products, and another like a shopping cart.
The idea is the user picks the product, enters in a text box the quantity and presses an 'Add' control button.
Once the add button has been pressed I want it to create a new record on the 'Cart subform' and set the productId, QTY and current price fields.
I have made this code;
When trying it, I get a 'Compile Error - method or data member not found' and the 'with me.CustOrderListSub' line is yellow highlighting the error
Why am I getting this error?
Thanks again,
Chris
Taking advice from here, I am trying to move away from Macro's and use more VBA, although it is a learning curve.
I have a main form with two subforms, one showing current products, and another like a shopping cart.
The idea is the user picks the product, enters in a text box the quantity and presses an 'Add' control button.
Once the add button has been pressed I want it to create a new record on the 'Cart subform' and set the productId, QTY and current price fields.
I have made this code;
Code:
' This is to add products to the cart subform
Dim ProdOrdered As Integer
Dim QTYProd As Integer
Dim ProdRetail As Currency
ProdOrdered = [Forms]![NewCustOrderMainFM]![CustSaleProductSelectFM]![ProductID]
QTYProd = [Forms]![NewCustOrderMainFM]![CustSaleProductSelectFM]![QtyToAdd]
ProdRetail = [Forms]![NewCustOrderMainFM]![CustSaleProductSelectFM]![CurrentRetailPrice]
With Me.CustOrderListSub
.SetFocus
DoCmd.GoToRecord Record:=acNewRec
Me.itempurchased = ProdOrdered
Me.ItemQTYpurchased = QTYProd
Me.RetailitemPrice = ProdRetail
DoCmd.RunCommand acCmdSaveRecord
End With
End Sub
When trying it, I get a 'Compile Error - method or data member not found' and the 'with me.CustOrderListSub' line is yellow highlighting the error
Why am I getting this error?
Thanks again,
Chris