Solved

Refreshing db after executing queries

Posted on 2003-11-03
4
170 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
ID: 9672011
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 70

Expert Comment

by:Éric Moreau
ID: 9672499
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 9675746
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
ID: 9683263
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
bit defender blocks good applications 2 93
MsgBox 4 59
vbModal 12 51
VBA - Excel, Hide/unhide range of rows on sheet with listbox selection 9 46
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

785 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