Solved

Refreshing db after executing queries

Posted on 2003-11-03
4
168 Views
Last Modified: 2010-05-03
Hi,
I'm using VB6 with access97, connecting to DB with ADO
I use one form to insert data into the DB.
I have another form with a combo box that populated with data from the DB,
The problem is that once I insert data, the combo box on the other form showes the new
data ONLY if O CLOSE the program and run it again.

How can I refresh the DB (like commit in Oracle) so I can re-populate the combo box?
thanx.
0
Comment
Question by:zolpo
4 Comments
 
LVL 3

Expert Comment

by:SQLMaster
Comment Utility
Hi Zolpo,

After inserting data, call the refresh method of ADO recordset in your first form and after that call the refresh method of combo box on another form

Cheers

Dheeraj


0
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
0
 
LVL 15

Expert Comment

by:JackOfPH
Comment Utility
Try this one!

combo1.clear
do until Ado.Recordset.EOF
Combo1.Additem Ado.RecordSet!YourField
Ado.Recordset.Movenext
loop

JackOfPH
0
 

Accepted Solution

by:
joyful88 earned 150 total points
Comment Utility
on your form, after inserting data:

Private Sub Insert_Click()  // or whatever event it is
    { ... your codes for inserting data into Access ...
      :
     }
     Unload Me
     Dim frmNewForm as New Form1
     frmNewForm.Show
End Sub

this reloads your form and updates your database; instead of closing your form to refresh manually, this does it for you automatically.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now