i'm using access and i need when i make any change in the database like adding new record that these changes apear in the form without closing the form and reopening it.
thanx in advance
____________________________
Seem Haroun
24-07-2006 at 09:30 AM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Re: how to refresh an access DB
Hi,
If you are using Access then the changes are immediately visible. Do you mean that you are storing data in Access and displaying the data in another application such as a windows form written in VB6 .? If that is the case then a lot depends on what data access technology you are using to retrieve the data from the Access database, and what type of Recordest you are reading it into, but in general if you run the "Requery" Command (Recordset.Requery or adodc.Requery etc.) then you will get the changes made to the database.
____________________________ multi-tasking - the ability to hang more than one app. at the same time.
quote:GeoffS wrote:
Hi,
If you are using Access then the changes are immediately visible. Do you mean that you are storing data in Access and displaying the data in another application such as a windows form written in VB6 .? If that is the case then a lot depends on what data access technology you are using to retrieve the data from the Access database, and what type of Recordest you are reading it into, but in general if you run the "Requery" Command (Recordset.Requery or adodc.Requery etc.) then you will get the changes made to the database.
yes i'm using acess. what i'm doing is that i'm opening a second form from a first 1 and i'm enserting a new record and after i close the second form the new record does not apear in the first form.
____________________________
Seem Haroun
24-07-2006 at 02:43 PM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Re: how to refresh an access DB
Hi,
You can put some code in your 2nd. Form to force the first Form to Requery its data and display the latest entry. If you are using the Forms "X" to close it then put the code in the Form_Unload Event, or if you have placed your own "Close" button on the Form then put it in the Button_Click Event prior to the "DoCmd.Close" statement:-
Private Sub CommandClose_Click()
DoCmd.RunCommand acCmdSaveRecord
Form_Form1.Requery
DoCmd.GoToRecord acDataForm, "Form1", acLast
DoCmd.Close acForm, "Form2"
End Sub
[Edited by GeoffS on 25-07-2006 at 08:04 AM GMT]
____________________________ multi-tasking - the ability to hang more than one app. at the same time.