i have a form that lists job orders for a given day that i enter myself, and then i have a print button with the following code - If IsNull(Me!ID) Then
-
MsgBox "Please select a valid record", _
-
vbOKOnly, "Error"
-
Exit Sub
-
End If
-
DoCmd.OpenReport "WORK ORDER REPORT", , , _
-
"ID = " & Me!ID
i have made a report that will print the current record based on the "ID" field. this sort of works except for the fact that when i type in my jobs, and click the print button it just prints a blank report, but if i close the form and then reopen it and go to the record i want and click print, it works fine... is there any way to remedy this and just click print, instead of having to reopen the form... thanks
4 1542 NeoPa 32,556
Expert Mod 16PB
Perhaps you could redo your last paragraph. Imagine the person reading it needs to understand exactly what you did when and what happened in those circumstances.
ok sorry about that, essentially if i fill in my form and click the print button, my report prints out but its blank. if i close the form and reopen it, then click print, the data prints. it seems as though the data is not recognized by my report until i close and reopen the form. does that help?
Hi,
It sounds like you have a list box or some other means of displaying a list of jobs on the form, and that when you select one of the records and hit your print button, you want the report for that record to print. Is this correct?
Pat
NeoPa 32,556
Expert Mod 16PB
Let me take a stab at what you're trying to say. I've tried to read between the lines here but there's still very little reliable information to work off so let me know if I've got it wrong) :
You have a report that should be opened (for display only as far as the code goes), but when running the code above (Post #1), instead of showing the matching record in the report, it shows an empty report.
The form has a control (possibly TextBox but ?) called [ID] which is used to filter the report. The [ID] value is numeric and is stored in a table that the form is bound to. This may be the same table the report is built on (bound to) but it may not. Whenever the {Print} Command Button is clicked, the [ID] from current record is the one that is used to filter the report.
If you can confirm this is what your question should have said then I can tell you that your code ought to be working and something strange is going on here. If, on the other hand, my assumptions about your question are wrong in any detail then you need to point that out.
If there is something strange going on, that is no cause for serious alarm. We can often manage to resolve quite complicated issues here, as long as we have a clear understanding of what those issues are.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Phil |
last post by:
I am looking to set up a hyperlink control on a form to retrieve letters
that correspond to a record on a form. That is, there may be 100 form
records, and I would like each of those form records...
|
by: sea |
last post by:
I need to be able to print the current form because the form has an
embedded object of a .gif file, so report will not work -- does anyone
know the way to do this? I tried some code, not sure what...
|
by: usenet |
last post by:
I want to be able to use the record numbers of a sub-form, are they
available anyhow in VB (Access 2003)?
I want to use the sub-form record number as *part* of the primary key
for the table...
|
by: MLH |
last post by:
Suppose that code running on FormB
is moving the focus around on FormA
to various textbox controls on FormA -
Which form is the current form during this process?
Is it FormA, which has the...
|
by: Deacon Dan |
last post by:
I want to be able to keep the current form on the current record. That
is, the arrow key, the tab or the enter should not cause the form to go
to next record or previous record. Preferably loop...
|
by: gary.cobden |
last post by:
Hi
I have a form/subform where a new record is created on the subform by a
button click.
After the new record is created, I then need to go directly and display
the new record in the subform....
|
by: herbiegrey |
last post by:
Hello
This is my first post on the forum so hello everyone.
I have a problem with access that I can't manage to view the current form record as a report ready to be printed.
I have a list...
|
by: Marks |
last post by:
Right I'm don't feel so nervous tackling VB as much now but basic stuff I'm great with so the next part of my script is:
1. Having a Front Menu. When you enter the number 1 in a textfield it...
|
by: thread |
last post by:
Hi
i built a form that getting dynamic SQL string,the SQL string is
placed in the record source when the form is opened.
i notice when trying to reduce some proccess time from the form that
it...
|
by: Soniad |
last post by:
Hi,
In my website, I show commodity details on daily basis.These details are stored in one table for each day.
I select record by matching current date and current date records are...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |