Results 1 to 16 of 16

Thread: Here's My Problem... "Refresh ADO" (RESOLVED)

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Exclamation Here's My Problem... "Refresh ADO" (RESOLVED)

    I use VB6 on WinXP - Using Access97 mdb.

    SEE SCREENSHOT BELOW!

    Here is what I have run into. I have learned ADO (code only - no controls) fairly quickly, but I have run into a snag...

    1) I open a db connection-recordset on Form_Load
    2) It fills in a datagrid
    3) All my Test buttons (plain 3D grey ones) all work fine.

    GREAT UP TO NOW!

    THEN I ADDED A FILTER! (not so good)

    On the right "LEDGER TOTALS" I filter totals from the db table (not the datagrid) to get my amounts... works fine!

    BUT...

    When I try to Add a record I get the ADO error.

    Here is the code for the filter...
    VB Code:
    1. Dim Inc As Integer, IncBal As Currency
    2. IncBal = "0.00"
    3. DoEvents
    4. Set adoPrimaryRS = New Recordset
    5. adoPrimaryRS.Open "SELECT * FROM Register", db
    6. adoPrimaryRS.Filter = "Type = 'Income'"
    7. For Inc = 1 To adoPrimaryRS.RecordCount
    8.     adoPrimaryRS.AbsolutePosition = Inc
    9.     IncBal = IncBal + adoPrimaryRS.Fields("Credit").Value
    10. Next Inc
    11. lbIncome.Caption = Format(IncBal, "0.00")
    12. adoPrimaryRS.Filter = adFilterNone

    I have 3 of these block in my procedure. The reason I know this is the problem is because I disabled the procedure and I could Add a record fine.

    Then to prove my point I enabled the procedure again. But before clicking the Add button, I clicked my Refresh button... WORKS FINE!

    This is what I need. I need a way to refresh the main data connection from with in the above procedure.

    I can not use the "Refresh" button because it will undo any sorts, filters, finds and column widths that were edited.

    So basically I have to give my data connection back to my app on the main form.

    Any Ideas?

    Thanks

    The Screenshot below has been made smaller to save size. Grey buttons on top are for testing purposes.
    Last edited by epixelman; Dec 20th, 2003 at 03:38 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width