S
strive4peace
Hi Nancy,
First thing I did was look at you relationship diagram.
Move Order Details to the right of Orders so data flows from left to right
enforce Referential Integrity on the relationship from Shipping Methods
to Orders
don't use lookup fields in your table design -- for instance, in Orders,
change the Display control of EmployeeID to a textbox. forms are where
you should have the combo boxes.
The Evils of Lookup Fields in Tables
http://www.mvps.org/access/lookupfields.htm
Since you are using OrderID to link tour subform to your mainform, you
need to put it ON your subform... you can set Visible = No so it does
not show
~~
In the code behind the Purchase Order Report, you have an error
change
If Not IsLoaded("Purchase Orders") Then
to
If Not CurrentProject.AllForms("Purchase Orders").IsLoaded Then
or, if you rename the form -->
If Not CurrentProject.AllForms("F_PurchaseOrder").IsLoaded Then
anyway, until you get the report working right, comment the lines for
the Report_Open event ... put a single quote ' at the beginning of each
statement so it turns green
you are getting the error about
[Purchase Orders].PurchaseOrderID
because that is how you have specified to group the report --
1. open the Sorting and Grouping window
2. click where [Purchase Orders].PurchaseOrderID is specified
3. drop the combobox and change the group field to --> Orders_OrderID
on F_PurchaseOrder
the reason your Preview Report button isn't doing anything is because
you don't have it running any code.
1. from the design view of the form, turn on the Properties
2. click on the Preview Report command button
3. click on the Event tab of the Properties window
4. click in the property labeled --> On click
5. from the combobox, choose --> [Event Procedure]
6. click the builder button [...] to the right and insert this code
between the procedure declaration Access provides for you and 'End Sub'
'~~~~~~~~~~~~~~~
Dim strWhere As String
strWhere = "Orders_OrderID=" & Me.OrderID
On Error Resume Next
'use this statement if you want the report to print
'DoCmd.OpenReport "Purchase Order", acViewNormal, , strWhere
'use this statement to preview the report
DoCmd.OpenReport "Purchase Order", acViewPreview, , strWhere
'~~~~~~~~~~~~~~~
put Orders_OrderID ON the report! It can have visible = No if you don't
want it to show.
remove the captions on OrderID, OrderDate, etc in your table design.
you should not use Captions in the table design -- when a table is
opened directly, it should be done by a developer and the real
fieldnames should show.
Warm Regards,
Crystal
Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm
*
have an awesome day
*
First thing I did was look at you relationship diagram.
Move Order Details to the right of Orders so data flows from left to right
enforce Referential Integrity on the relationship from Shipping Methods
to Orders
don't use lookup fields in your table design -- for instance, in Orders,
change the Display control of EmployeeID to a textbox. forms are where
you should have the combo boxes.
The Evils of Lookup Fields in Tables
http://www.mvps.org/access/lookupfields.htm
Since you are using OrderID to link tour subform to your mainform, you
need to put it ON your subform... you can set Visible = No so it does
not show
~~
In the code behind the Purchase Order Report, you have an error
change
If Not IsLoaded("Purchase Orders") Then
to
If Not CurrentProject.AllForms("Purchase Orders").IsLoaded Then
or, if you rename the form -->
If Not CurrentProject.AllForms("F_PurchaseOrder").IsLoaded Then
anyway, until you get the report working right, comment the lines for
the Report_Open event ... put a single quote ' at the beginning of each
statement so it turns green
you are getting the error about
[Purchase Orders].PurchaseOrderID
because that is how you have specified to group the report --
1. open the Sorting and Grouping window
2. click where [Purchase Orders].PurchaseOrderID is specified
3. drop the combobox and change the group field to --> Orders_OrderID
on F_PurchaseOrder
the reason your Preview Report button isn't doing anything is because
you don't have it running any code.
1. from the design view of the form, turn on the Properties
2. click on the Preview Report command button
3. click on the Event tab of the Properties window
4. click in the property labeled --> On click
5. from the combobox, choose --> [Event Procedure]
6. click the builder button [...] to the right and insert this code
between the procedure declaration Access provides for you and 'End Sub'
'~~~~~~~~~~~~~~~
Dim strWhere As String
strWhere = "Orders_OrderID=" & Me.OrderID
On Error Resume Next
'use this statement if you want the report to print
'DoCmd.OpenReport "Purchase Order", acViewNormal, , strWhere
'use this statement to preview the report
DoCmd.OpenReport "Purchase Order", acViewPreview, , strWhere
'~~~~~~~~~~~~~~~
put Orders_OrderID ON the report! It can have visible = No if you don't
want it to show.
remove the captions on OrderID, OrderDate, etc in your table design.
you should not use Captions in the table design -- when a table is
opened directly, it should be done by a developer and the real
fieldnames should show.
Warm Regards,
Crystal
Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm
*
have an awesome day
*