Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    3

    Angry Unanswered: Saving to the database

    HI! Members

    Please help! I need to get an amount from database, display it on a textbox and accept a number from the user. Subtract the user number from the amount in the textbox then put the answer back in that text box.

    All that I have done, Now I need to save the new amount to the database and exit. My info is like this:

    Database - MsAccess 2000
    Name (Money) -- Table (Balances) -- Field (Curr_Bal)


    I'm using ADO connection and I've tried putting the following code in the cmdSave button : 1. adBalances.fields("Curr_Bal")= text1.text
    adBalances.Update
    2. adBalances.recordset.update

    I've tried these two seperately and I'm getting no response at all, I mean no errors. When I exit the program and run it again the amount from the database is still the same and I need the program to update the database everytime this transaction is perfomed.

    Can someone please help.
    Attached Thumbnails Attached Thumbnails .jpg  

  2. #2
    Join Date
    Jan 2004
    Posts
    184

    Re: Saving to the database

    To use the update property you must set the correct cursortype and cursorlocation as well as locktype. Try this control featured on download.com that I have been using that has made my life easier:

    http://download.com.com/3000-2404-10...ml?tag=lst-0-1

    After selecting the CursorType, CursorLocation, LockType and Disconnected status of your Recordset (there are defaults). I bind my controls and that is it All the complexities of ADO are hidden from the user which is you.

    Then I can Navigate, Add New, Delete, Refresh, Search and Save Changes to my recordsets without any other code. That is really it, no other code is needed.

    This works in any environment VB, Access, VC++ etc...

    Let me know what you think.

    Originally posted by Thato
    HI! Members

    Please help! I need to get an amount from database, display it on a textbox and accept a number from the user. Subtract the user number from the amount in the textbox then put the answer back in that text box.

    All that I have done, Now I need to save the new amount to the database and exit. My info is like this:

    Database - MsAccess 2000
    Name (Money) -- Table (Balances) -- Field (Curr_Bal)


    I'm using ADO connection and I've tried putting the following code in the cmdSave button : 1. adBalances.fields("Curr_Bal")= text1.text
    adBalances.Update
    2. adBalances.recordset.update

    I've tried these two seperately and I'm getting no response at all, I mean no errors. When I exit the program and run it again the amount from the database is still the same and I need the program to update the database everytime this transaction is perfomed.

    Can someone please help.

  3. #3
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    3

    Re: Saving to the database

    Hi! Rami

    I have tried the syntax:

    adoRS.recordset.fields("column_name") = text1.text
    adoRS.recordset.update

    It worked. however I have just downloaded the program you mentioned I will give it a try and will let you know how it went. I'm currently at work so I might take a while before I get back to you

    Thanx for your response, I was begining to lose hope in this forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •