I have a form with a sub form which displays cargo tank details for a particular vessel. The main form has an unbound text box which is used to select the vessel name, based on a table (TblVesselDetails) and the sub form displays a series of records, each of which contains details for one cargo tank for that vessel, based on a table (TblCT_Partic). The two tables are linked by means of a query (QryCTPartic) using the field “Vessel”.
On the main form is a Command Button which uses the “OutputTo” method to export the data from TblCT_Partic to Excel. The Excel data is then copied into an Excel Spreadsheet which is sent to operators in the field for updating. At present, the OutputTo method runs a second query (QryCTP) which is a copy of QryCTPartic but requires the vessel name to be specified. (“[Enter Vessel]”).
What I would like the Command Button to do is to run QryCTPartic and automatically select the vessel name, rather than prompting me for it.
The current code for the Command Button is:
Any help would be much appreciated.
Best Regards
John
On the main form is a Command Button which uses the “OutputTo” method to export the data from TblCT_Partic to Excel. The Excel data is then copied into an Excel Spreadsheet which is sent to operators in the field for updating. At present, the OutputTo method runs a second query (QryCTP) which is a copy of QryCTPartic but requires the vessel name to be specified. (“[Enter Vessel]”).
What I would like the Command Button to do is to run QryCTPartic and automatically select the vessel name, rather than prompting me for it.
The current code for the Command Button is:
Code:
DoCmd.OutputTo acOutputQuery, "QryCTP", acFormatXLS, "CTP.xls", True
Best Regards
John