need help with syntax of ado.recordset.addnew function
All I need is the correct syntex for the adoOrder.recordset.addnew line:
Private Sub cmdCartit_Click()
'this button is supposed to take whatever
'was ordered from item listed and put it in cart
' by creating a temporary database that will be seen on
'the final form
Dim Quantity As String, ID As String, Product As String, Price As String, ExtendedPrice As String
'grab the information off the GUI
Quantity = txtQuantity.Text
ID = lblID.Caption
Product = lblToolOrdered.Caption
Select Case optDealerOption(index).Value = True
Case index = 0
Price = lblPrice(2).Caption
Case index = 1
Price = lblPrice(1).Caption
Case index = 2
Price = lblPrice(0).Caption
End Select
ExtendedPrice = lblExtendedPrice.Caption
'use the ado control to enter data into feild.
adoOrder.Recordset.AddNew ([fldID],[ID] & [fldProduct],[Product] & [fldPrice], [Price] & [fldExtendedPrice],
[ExtendedPrice])
You can assume that the items in the brackets with fldprefix are the feilds of the db
and that the second[*] are supposed to be the strings created above.
now getting syntax error here.
here's what I have now
Private Sub cmdCartit_Click()
'this button is supposed to take whatever
'was ordered from item listed and put it in cart
' by creating a temporary database that will be seen on
'the final form
Dim Quantity As Integer, ID As String, Product As String, Price As Currency, ExtendedPrice As Currency
'grab the information off the GUI
Quantity = txtQuantity.Text
ID = lblID.Caption
Product = lblToolOrdered.Caption
Select Case optDealerOption(index).Value = True
Case index = 0
Price = lblPrice(2).Caption
Case index = 1
Price = lblPrice(1).Caption
Case index = 2
Price = lblPrice(0).Caption
End Select
ExtendedPrice = lblExtendedPrice.Caption
'use the ado control to enter data into feild.
Dim aFields(4) As Long
aFields(0) = fldID
aFields(1) = fldProduct
aFields(2) = fldPrice
aFields(3) = fldQuantity
aFields(4) = fldExtendedPrice
adoOrder.Recordset.AddNew aFields(0 To 4) , Array(ID, Product, Price, Quantity, ExtendedPrice)
Getting a syntax err for the ado statement. Anybody no what's missing?
thanks for all your help still getting a bug
fld* are the feild names of my blank access database. here's what I got now:
Private Sub cmdCartit_Click()
'this button is supposed to take whatever
'was ordered from item listed and put it in cart
' by creating a temporary database that will be seen on
'the final form
Dim Quantity As Integer, ID As String, Product As String, Price As Currency, ExtendedPrice As Currency
'grab the information off the GUI
Quantity = txtQuantity.Text
ID = lblID.Caption
Product = lblToolOrdered.Caption
Select Case optDealerOption(index).Value = True
Case index = 0
Price = Val(lblPrice(2).Caption)
Case index = 1
Price = Val(lblPrice(1).Caption)
Case index = 2
Price = Val(lblPrice(0).Caption)
End Select
ExtendedPrice = Val(lblExtendedPrice.Caption)
'use the ado control to enter data into feild.
'use the ado control to enter data into feild.
Dim aFields(4) As Long
aFields(0) = fldID
aFields(1) = fldProduct
aFields(2) = fldPrice
aFields(3) = fldQuantity
aFields(4) = fldExtendedPrice
adoOrder.Recordset.AddNew aFields, Array(ID, Product, Price, Quantity, ExtendedPrice)
I'm getting "Object variable or withblock variable not set"
as my bug. on the adoOrder.recordset.addnew line
John