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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force Update

Status
Not open for further replies.

katiekat

Technical User
Jun 6, 2000
300
US
Hi there all,

I have a data entry form with 2 subforms on it. One of these has some calculation feilds that are only on the form. I also have a button that prints the current record using a different form.

When I use this button to print the record I JUST entered, the caluations on the subform are not printed. If create a new record, then go back and print, it will print out.

So I'm thinking that I need to force an update of this info before I use that print button. I am thinking that I could use an afterupdate event in the last feild of my form, or an onexit in the subform....I'm just not exactly sure what I should be putting there.

Any help would be greatly appreciated! THANKS!

Kate

Holy tek-tips batman!:-0
 
Assuming your second form is frmExtra then when you click the print command button use this code: cmdPrint_Click
Forms!frmExtra.requery
doCmd.OpenReport "rptReportName",,,acPreview
 
Dim strdocname As String
Dim strWhere As String
strdocname = "Work order"
strWhere = "[ID]=" & Me!ID

Forms!Work order.Requery
DoCmd.OpenForm strdocname, acNormal, , strWhere
DoCmd.PrintOut
DoCmd.Close

This is the code that I have on my button at this point. When I run it like this, I get a compile error. I tried renaming the form so there was no space in the middle, and it still said that it could't locate the form. Do I have things in the wrong order or something?

Thanks for the help!

Holy tek-tips batman!:-0
 
Hi Kate,
I would think the problem is the space in the form name you need to use [] brackets for any name with spaces.

Forms![Work order].Requery
This should resolve the compile error... I hope!
 
Brackets solved the compile error, but it still says that it can't find the form.

Should I try this requery action in some other place?

Holy tek-tips batman!:-0
 
Ok. The button works, but the info is still not printing until I create a new record.

This is mighty frustrating.

Holy tek-tips batman!:-0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top