Hi, I am trying to add product groups to my order form. For a single item the ProductCombo pulls the following: ProductCombo.RowSource = "SELECT ProductID, ProductName, UnitPrice, Units, IsSalesTax, " & _ " IsAlcoholTax, IsServiceCharge, ProductSubCategoryID, IsServiceChargeTax " & _ " FROM ProductT " & _ " WHERE ProductSubCategoryID = " & ProductSubCategoryCombo & _ " ORDER BY ProductName;"
I am attempting to DLOOKUp the values for IsSalesTax, IsAlcoholTax, IsServiceCharge, and IsServiceChargeTax BUT these items are only used as a criteria for a query which determines the actual rate of tax entered on the OrderDetailT, so the system doesn't recognize the control.
I'm able to set the controls for the single combobox with the following code, but how can I pull this off in a record set?
If rsGroupDetail!IsSalesTax = False Then
rsGroup!SalesTaxRate = 0
End If
If rsGroupDetail!IsSalesTax = True Then
rsGroup!SalesTaxRate = Forms!OrderF!SalesTaxRate
Else
rsGroup!SalesTaxRate = 0
End If
If rsGroupDetail!IsAlcoholTax = True Then
rsGroup!AlcoholTaxRate = Forms!OrderF!AlcoholTaxRate
Else
rsGroup!AlcoholTaxRate = 0
End If
If rsGroupDetail!IsServiceCharge = True Then
rsGroup!ServiceChargeRate = Forms!OrderF!ServiceChargeRate
Else
rsGroup!ServiceChargeRate = 0
End If
If rsGroup!IsServiceChargeTax = True Then
rsGroup!ServiceChargeTaxRate = Forms!OrderF!ServiceChargeTaxRate
Else
rsGroup!ServiceChargeTaxRate = 0
End If
rs.Update
rsGroupDetail.MoveNext
Wend
rsGroupDetail.Close
rsGroup.Close
Set rsGroupDetail = Nothing
Set rsGroup = Nothing
Me.Requery
Lesli CochranOP
@Reply 4 years ago
Ok, so just posting a problem helps :) This code runs without errors but doesn't actually load the row, so its kinda a new question?! I just wanted to update:
Private Sub AddPackageButton_Click()
Dim rsGroup As Recordset, rsGroupDetail As Recordset
Set rsGroup = CurrentDb.OpenRecordset("OrderDetailT")
'ADD THE PACKAGE AS A LINE ITEM
'rsGroup.AddNew
'rsGroup!OrderId = Forms!OrderF!OrderId
'rsGroup!ProductID = 0
'rsGroup!ProductName = ProductGroupCombo.Column(1)
'rsGroup!Quantity = 1
'rsGroup!UnitPrice = 0
'rsGroup.Update
'LOOP THRU DETAILS AND ADD AS PRODUCTS
Set rsGroupDetail = CurrentDb.OpenRecordset("SELECT * FROM ProductGroupDetailT " & _
"WHERE ProductGroupID=" & ProductGroupCombo, dbOpenSnapshot)
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Developer 25.