Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with opening reports with info just entered on a form!

Status
Not open for further replies.

ljjtek

Technical User
Feb 26, 2001
35
US
OK,
I have a form based on query,which I have set up as a proposal. On the form I have a preview report button and I when clicked it opens the report for the current record, so that, I have taken care of. The problem is that when I write info into the form and then preview the report, it doesn't show the info that I just entered! If I want it to update then I have to close the form, open the query, close the query, open the form, open the report..... Obviously this is not going to work.

How do I make this work? I am incredibly new to MS Access, so I'm probably missing something obvious....but I don't know. Anyone know what I should do??

Thanks,
LJJ
 
Hi ljjtek,
My first guess is that the issue is: Info you enter into a form doesn't completely save until you leave the record, exit the form, or click the "Save" button on the toolbar (whichever you do first).

Anyway, I'm guessing this is the issue. If it is, there's a pretty simple way to find out: after entering data, click the "Save" button on the toolbar, and then open the report. Does it work then?

If so, there is a way to automate this so users won't even have to do that much, but it involves going into the code. Please let me know if you'd like me to try to walk you through that.. :cool:
 
HI,
OK.... Well, I tried what you said and hit the save button on the tool bar...and that didn't work. But, if I A)exit the form, or B)Exit the record, then it does work.

I have been working on setting up this database for weeks! I thought it was going to be simple but no such luck. I don't really know any code, I mean I cut and paste, and am not totally clueless, but any direction you could give me would be GREATLY appreciated!

Thanks Katerine!
 
Hi ljjtek,
I'm sorry.. I haven't had my caffeine today :)

I've never actually known entirely for sure whether the Save button on the toolbar saves the record or the form. Probably the form. So it makes sense that this wouldn't work.

Try the following next (and if this doesn't work then I'm definitely barking up the wrong tree).. create a new command button on your form. When the command button wizard pops up (I'm going to assume it's enabled), select Record Operations | Save Record. Set text to "Save" for now, and name the button "cmdSave". (thus endeth this session of "Naming Conventions 101.")

Now try going in, entering changes, click the "Save" button you just created, then click the report button. If it works, you can automate it by copying and pasting the code (minus the error handling code) from cmdSave_Click to the beginning of the report button's Click procedure (that is, the beginning after the "on error goto ..." line)

Hope that helps! Please let me know if this is completely off-base..
 
Hi Again,
OK, well it certainly does work!! Thank you, thank you... Now however, like I said, I am OK, with copy and paste code, but I haven't had my coffee and so I was a little confused as to what I should copy and paste.... I have pasted the code currently..... what should I copy? paste?

Thanks for your help on everything.....you have no idea how much time you have saved me!

Lauren




Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_cmdSave_Click:
Exit Sub

Err_cmdSave_Click:
MsgBox Err.Description
Resume Exit_cmdSave_Click

End Sub
 
:)

Just copy the line:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Copy it to the report button's code, somewhere before the "docmd.OpenReport ..." line. This will remove the need for users to click the save button prior to clicking the report button.. it will save the record automatically.

Glad to help!
 
Thank you, Thank you, Thank you!!!!

Can I hire you?! Well, OK, I probably can't afford that... but how about if I can ask you questions as problems come up? You write so that I can understand what you are saying and so that I don't feel intimidated by all the technical talk. I promise not to bother you too much though!

Thanks again Katerine,

Lauren
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top