George:
You shouldn't need to insert the record into another table. Why not simply
base the label report on the original table or query and open the report
filtered to the selected record? Lets assume the key field which identifies
the record uniquely is called ItemID and this is a number. I'm guessing you
are selecting the item from the combo box you refer to on your other recent
thread, so to print the label report for just the selected record the code
for the Click event procedure of a button on the form would be:
Dim strCriteria As String, strReport As String
strCriteria = "[ItemID] = " & me.CboItems
strReport = "YourReportNameGoesHere"
DoCmd.OpenReport strReport, WhereCondition:=strCriteria
To preview it use:
DoCmd.OpenReport strReport, View:=acViewPreview, WhereCondition:=strCriteria
To insert the quantity in the report add an unbound text box, txtQuantity
say, to the form and in the report add an unbound text box whose
ControlSource property references the control on the form, e.g.
=Forms![YourFormName]![txtQuantity]
The form must be open when the report prints so if you want it to close
automatically put the code to close it in the report's Close event procedure:
DoCmd.Close acForm,"YourFormName"
The above assumes of course that you are not saving the quantity in a field
in a record (as in the Order Details table in the sample Northwind database),
but simply want to insert it manually each time into the label.
Ken Sheridan
Stafford, England
George Sydney said:
I am creating a label program where i can select and product from a table
and store the selected item to another table so i can print the selected item.
I was wondering if I could enter a value and press the print button so the
program will automatically print the qty entered in the qty field.
Thanks