I am having trouble print previewing the current record from my form that is showing. I tried the command button, but it only shows the first record. Could someone please help?
I am having trouble print previewing the current record from my form that is showing. I tried the command button, but it only shows the first record. Could someone please help?
How do you enter this code correctly? I am new to this.
This is where you enter the code:
http://www.baldyweb.com/FirstVBA.htm
In answer to your PM, if you still need help you should be able to attach the db here, after doing a compact/repair and zipping.
I am still having trouble and would like to send the file. I have compacted and repaired. How do you send as zip and where do you attach the file?
Thank you,
billgyrotech
pbaldy,
I have attached the zip file. When opening the database it opens Workorders by Customer. On the form there is a button (AFR) for what I want to do: preview the report with the current record. What happens now is it only previews the first record (Workorders). If I select a different Workorder on the subform the report shows only the first Workorder. I hope you can help.
Thanks,
billgyrotech
Last edited by billgyrotech; 07-26-2011 at 01:07 PM. Reason: additional details
I am sorry about that. It is the AFR button.
Thanks
That button doesn't incorporate the code in my link. You have other button code that uses that technique, though the buttons don't appear to exist anymore. Did you try incorporating that technique into this button?
Yes I tried but to no avail. It still only shows the first Workorder.
What did you try, so we can fix it? The other efforts appeared correct but looked to be using the name of the form instead of the name of the field in the report.
This is why I need help. I am not sure how to fix this command button to yield the current or chosen workorder number for the report.
You said you tried, I was hoping to see the effort and fix it. Try
DoCmd.OpenReport "ReportName", acViewPreview, , "CustomerID = " & Me.CustomerID
presuming that's the field you want filtered on.
It is filtered on WorkorderID so I put that in. The code seems to work and asks for the Workorder number to be entered. If the disposition field is blank then the report is blank. Can this be fixed to generate the work order while it is being repaired?
It shouldn't ask, it should get it from the form. What exactly is your code, and where is it supposed to get the workorder. That appears to be on the subform.