Currently working with Microsoft Office 2000 and whatever version of Access came with that.
I am developing a database to track the comings and goings of shared tools.
Everything works splendidly except I have printing issues, primarily I have no idea what I am doing.
I have a form that contains the date and the info of the person doing the ordering as well as a subform that has the serial number of the part, the description and storage location. The subform is set up as datasheet view so that multiple items can be ordered at once.
When the orderer clicks on the order button that closes the order form & subform and opens the home page. But I also need it to print off a list of what has been ordered (subform info) and the info of the person doing the order (form info).
I have tried using the print commands in the VB docmd. part but they do not seem to do what I require. I have tried to use the queries that the form and subform are running off of to make a report that will print, this had limited succes as it printed off everything that has ever been ordered. I tried making a new query with the criteria of the order date being =now() but that did nada.
Sooo...anyone have any suggestions to solve my quandry??
8 1938
It sounds like you were headed in the right direction. I would make a report based on the queries that the form is based on. Then I would add this script to your Order Button... - Dim strDocName as String
-
Dim strLinkCriteria as String
-
strDocName= "YourReportName "
-
strLinkCriteria="YourPrimaryKey =Forms![YourFormName ![YourPrimaryKey ]"
-
DoCmd.OpenReport strDocName, acViewNormal,strLinkCriteria
This will open your new report with only the record containing the primary key that is showing on the form. You could change acViewNormal (above) to acViewPreview while you are playing with it. It will then do PrintPreview instead of printing out directly.
Hope this helps,
Brad.
In the future, please refrain from using all caps in your title or post! Online this is considered to be shouting makes reading the text difficult. Many members will simply ignore a poster who engages in this behavior.
Welcome to The Scripts!
Linq ;0)>
Well I did all of that. What happens now is it opens the report but is still showing what has been ordered. It is not recognizing the Link Criteria, that I only want the current form to print.
This is what I have on my button thus far (this is for OnClick): - Private Sub cmdOrder_Click()
-
Dim strDocName As String
-
Dim StrLinkCriteria As String
-
strDocName = "rptOrder"
-
StrLinkCriteria = "OrderNumber=Forms![Order![OrderNumber]]"
-
DoCmd.OpenReport strDocName, acViewPreview, StrLinkCriteria
-
End Sub
So I don't quite know where to procced from here. I have tried using the primary key on my subform, but that made no changes.
Well I did all of that. What happens now is it opens the report but is still showing what has been ordered. It is not recognizing the Link Criteria, that I only want the current form to print.
This is what I have on my button thus far (this is for OnClick): - Private Sub cmdOrder_Click()
-
Dim strDocName As String
-
Dim StrLinkCriteria As String
-
strDocName = "rptOrder"
-
StrLinkCriteria = "OrderNumber=Forms![Order![OrderNumber]]"
-
DoCmd.OpenReport strDocName, acViewPreview, StrLinkCriteria
-
End Sub
So I don't quite know where to procced from here. I have tried using the primary key on my subform, but that made no changes.
You did not quite follow the syntax that Brad gave you for StrLInkCriteria. You have a missing right parenthese in one section of the string and an extra right parentheses at the end of the string. Also, the syntax of the string assumes that OrderNumber is a text data type. If OrderNumber is a numeric data type the syntax would have to be changed.
change this:
StrLinkCriteria = "OrderNumber=Forms![Order![OrderNumber]]"
To this:
StrLinkCriteria = "OrderNumber=Forms![Order]![OrderNumber]"
OrderNumber is an auto number as it is the primary key and serves no purpose other than to give a number to the order.
What would need to be changed since it is numeric data?
OrderNumber is an auto number as it is the primary key and serves no purpose other than to give a number to the order.
What would need to be changed since it is numeric data?
Private Sub cmdOrder_Click()
Dim strDocName As String
Dim lngLinkCriteria As Long
strDocName = "rptOrder"
lngLinkCriteria = "OrderNumber = " & Forms![Order]![OrderNumber]
DoCmd.OpenReport strDocName, acViewPreview, lngLinkCriteria
End Sub
Private Sub cmdOrder_Click()
Dim strDocName As String
Dim lngLinkCriteria As Long
strDocName = "rptOrder"
lngLinkCriteria = "OrderNumber = " & Forms![Order]![OrderNumber]
DoCmd.OpenReport strDocName, acViewPreview, lngLinkCriteria
End Sub
Well that kind of worked, it now shows a report of all items that have been returned. Which makes no sense as returned and ordered have no direct relationships.
I am going to assume that I have made an error somewhere else in my database because the code should work.
Well that kind of worked, it now shows a report of all items that have been returned. Which makes no sense as returned and ordered have no direct relationships.
I am going to assume that I have made an error somewhere else in my database because the code should work.
Try it this way as per the link below:
Private Sub cmdOrder_Click()
Dim strDocName As String
Dim strLinkCriteria As String
strDocName = "rptOrder"
strLinkCriteria = "OrderNumber= '" & Forms![Order]![OrderNumber] & "'"
DoCmd.OpenReport strDocName, acViewPreview, strLinkCriteria
End Sub http://support.microsoft.com/kb/209560 Sign in to post your reply or Sign up for a free account.
Similar topics
by: William Wisnieski |
last post by:
Hello Everyone,
Access 2000
I have a main form with a continuous subform. On the main form I have a
text field called . It gets populated based on what the user
selects in a field on the...
|
by: xmp333 |
last post by:
Hi,
I have a form that is designed as a data sheet view. Attached to this
is a subform with some VB code. When the user clicks on a row, the
subform should pop up and run the VB code which...
|
by: Randy |
last post by:
I have tried the code to attach a button to a form and use the help
information on coding, but I can't seem to get it to work.
I have a main form called MAIN CLIENT INFO2
There is a subform...
|
by: kkrizl |
last post by:
I have a form that displays general information about an alarm permit
location. There's a subform that shows detailed information about
burglar alarms that have gone off at the location. When a...
|
by: Thelma Lubkin |
last post by:
I have a form/subform with the common one-to-many relationship.
The form allows user to display records and move to other records
via the selector, to add,delete, and edit them, with the related...
|
by: Robert |
last post by:
Need some help to stop me going around in circles on this one....
Have a nested subform (subform2) which simulates a continuous form for the
record on the parent subform.
Subform2 has rows of...
|
by: christianlott1 |
last post by:
I admit my form is pretty complex and may need a total overhaul -
I have two subforms synchronized on a form through an unbound text box.
When I enter a new record in the second subform it used...
|
by: asavu |
last post by:
Hello,
I'm somewhat new to this, and I definately need some help. I have a db for a small business, and I have a main form, Customer Info, which has a subform Appliance Info, which has a subform...
|
by: sparks |
last post by:
I have a form/table with an autoid it is linked to a table/form with
and ID as a 1 to many.
Under this form/table I need another table with many records for each
on of the many in the previous...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |