?
Solved

Very Urgent!!!

Posted on 2000-05-02
8
Medium Priority
?
180 Views
Last Modified: 2010-05-02
Hi All,
I have a VB program with 2 forms, 1 is data entry(add,update,delete) and the other is a form with 10 option buttons for different reports, and a 'show report' button that does a print preview (report.show). The problem Im having is that if I go into form 1 and change some data on a record, it doesn't show up on the report unless I exit the program and re-enter. Any light you could shed on this would be greatly appreciated. (Using DAO)

Thanks in advance,
0
Comment
Question by:shyma
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2769094
You need to refresh your recordset.

Show us some code of what you are doing!
0
 
LVL 15

Expert Comment

by:ameba
ID: 2769105
Maybe your report form does not unload, or it unloads, but is not set to nothing, so some form variables retain their values. Use this code:

Private Sub cmdReport_Click()
' show frmReport form
    Dim test As New frmReport
    test.Show vbModal
    Set test = Nothing
End Sub
0
 

Author Comment

by:shyma
ID: 2769307
I have got a master form conatins Header and details records. When I navigate through master records I can see the corresponding detail records also. In the same form I have put one Command Button to Print the current displayed information. (let us assume like an Ivoice - carries Header and Detail information.)  When I click the command button it is calling a datareport (datareport.show). It will not show the current one. Once I close and reopen the form then only it show the one we pressed. An Urgent reply is highly appreciated.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2769350
0
 
LVL 15

Expert Comment

by:ameba
ID: 2769701
If I understand your reply
>When I click the command button it is calling a datareport (datareport.show).

your code looks like this:
Private Sub cmdReport_Click()
' show frmReport form
    frmReport.Show
End Sub

Can you, please, reply to my suggestion, it was to use code like this:

Private Sub cmdReport_Click()
' show frmReport form
    Dim test As New frmReport
    test.Show vbModal
    Set test = Nothing
End Sub
0
 

Author Comment

by:shyma
ID: 2769939
I tried both solutions. But unfortunately it doesnot help me. Eagerly waiting for another suggestions.

Thanks a lot for your suggestions.
0
 
LVL 1

Accepted Solution

by:
pauljk earned 200 total points
ID: 2770000
You need to ensure that your data edit form is saving the information to the recordset.  You can force this with a button or you can use some kind of event like lost focus.  

The second form needs to have a refreshed recordset, especially if it is a disconnected recordset.  You can also re-run the report diplay code in your form by placing it in the On_Activate event of your Report form.  Here you can force your form to get new data.
0
 
LVL 1

Expert Comment

by:yfang
ID: 2771009
Here is a solution:

Add the following code before you show your report:

If DataEnvironment1.Connection1.State=1 then
DataEnvironment1.Connection1.Close
end if
DataEnvironment1.Connection1.Open
DataEnvironment1.Command1

Here DataEnvironment1, Connection1, and Command1 are the default names, which yo may need to replace with the ones you used in your project.
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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

862 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