PLEASE!!! help a struggling Student of VB with a nagging problem, this is directed to all the VB gur

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

Hi all,

I am doing a course in VB and have written a small sales program but I
have hit a wall with the following problem.

I made a Dim for ordernumber and I made a ADOdc7 which is linked with
a database and a table in access, but I cant get the Dim to work and
make it save the info in the program to the database table which will
be for billing. Any idea what is wrong with this code?? I have pasted
it following this message so please have a look and anything with
List***.text or txt***.text is a text box or list box.

ADOdc4 has the product information and ADOdc7 is the billing table
which the manager needs to view at the end of the day with all the
sales saved into it. I can't figure out the problem with it yet so all
help will be greatly appreciated.

Also I have uploaded a zipped copy of the program to alt.binaries.test
if anyone needs it to help me with the problem. All that needs to be
done is to rebuild the ADO's to the new location of the database file
to make it run.

Also the Employee login password is "staff" and the manager login
password is "boss" if anyone gets this program.

Best regards,

Chris






Dim OrderNo As Integer
Dim Quantity As Integer
Dim ItemPrice, DeliveryPrice, SpeedPrice, Totalcost, QuantityPrice,
TotalPrice As Currency



Private Sub Form_Load()

With Adodc7.Recordset
.MoveLast
OrderNo = ![OrderNumber]
.MoveFirst
End With

End Sub




Private Sub cmdOrder_Click()

With Adodc7.Recordset
.AddNew 'adds new empty record
'below textbox values are
saved into the fields
![First Name] = TxtFN.Text
![last Name] = TxtLN.Text
![Total Price] = TxtTotal.Text
![Delivery Location] = ListDest.Text
![Product Name] = ListProduct.Text
![Quantity In Stock] = TxtAmt.Text
![Quantity Bought] = ListQuantity.Text
![Restock Number] = TxtRestock.Text
![Date] = TxtDate.Text
![Time] = TxtTime.Text
OrderNo = OrderNo + 1 'gets a new order #
![OrderNumber] = OrderNo
.Update 'Saves all the fields
MsgBox "Transaction saved"
End With

With Adodc4.Recordset ' calculates current stock
.Find "[Product Name] = '" & ListProduct.Text & "'"
![Amt In Stock] = ![Quantity In Stock] - Quantity
.Update
End With
End Sub
 
Hi Chris,

As everybody else who is using classic Ado you get the same answer here.
Ado becomes less and less into our minds. Most of us are using ADONET.
I think that for this kind of problems a classic ADO newsgroup can give much
more help.

And as an advice when you are a student, start over again and have a look at
ADONET, it is much easier to handle, although some people who have done
expirience with ADO do deny that until they have used ADONET.

And do than not to do it the way as you was used to do with ADO, use with
ADONET databinding for single field controls as textboxes, while you can use
for more complex controls as the datagrid, the combobox and the listbox the
datasource. (This is not for all, it is not yet at the treeview and the
listview by instance)

I hope this helps?

Cor


Cor
 
Back
Top