Solved

Refreshing db after executing queries

Posted on 2003-11-03
4
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month9 days, 5 hours left to enroll

615 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