Solved

Very Urgent!!!

Posted on 2000-05-02
8
171 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
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 50 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

837 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