Solved

Very Urgent!!!

Posted on 2000-05-02
8
169 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 69

Expert Comment

by:Éric Moreau
Comment Utility
You need to refresh your recordset.

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

Expert Comment

by:ameba
Comment Utility
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
Comment Utility
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
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 15

Expert Comment

by:ameba
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now