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

Command button help...

Status
Not open for further replies.

gacollier

IS-IT--Management
Feb 5, 2004
192
US
I'm brand spanking new to MS Access and am looking for some help on how to use "command buttons".

Here's my scenerio...

I have a database for a simple order system similar to the sample "Northwind" DB. On the "Orders" screen, I'd rather see a button title "Order details", rather than the "Orders Subform", that will allow me to "drill down" into the order details. Unfortunatley when I use the button wizard to open a form it shows all "Order Subform" records, not just the one's related to one particular order.

I'm looking for a site or link to a tutorial for doing this.

I realize that this might be fairly easy but I can't seem to weed through all the tutorials on the web for htis exact item.

Thanks in advace.

 
Have you defined the Master/Child dependancy between the form and the subform ?
Are the tables relationships defined ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Can you use the Order No. from your master form as a parameter on the subform's record source (like the query)?

This way, when you click the 'Orders Details' button, it could requery the subform's recordsource, and, since that recordsource has a parameter of, let's say, Order No., only those records attached to that Order No. would result, thus only those records would show on your subform.

The trick is, when your master form has a new/different Order No. on it, you must requery the suboform when you click 'Order Details' button. Something like:

cmdOrderDetails_Click()
YourOrderSubmformName.Requery
end sub

Hope this helps. Good Luck.
 
PHV and batteam,

Thanks for the help. I used "stLinkCriteria" and it worked like a charm. Basically filtering out any records that don't match the parent forms "OrderID" field.

Dim strDocName As string
Dim stLinkCriteria As String
strDocName = "OrdersSubform"
stLinkCriteria = "OrderID = Forms!Order!OrdersSubform!OrderID"
DoCmd.OpenForm strDocName, , , stLinkCriteria

Thanks again for your help.

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top