Happy to help!
Happy to help!
actually, one more question:
I'm reviewing the code to make sure i fully understand it (it was made by a former coworker).
i dont quite understand the"[ID]=" &pRecID from the printlabels() code
DoCmd.OpenReport "rpt_leadbond_yield_label", acViewPreview, , "[ID]=" & pRecID
The wherecondition argument of OpenReport is an SQL "WHERE" clause without the word "WHERE". If you wanted to run the report for ID 123 it would look like
"ID = 123"
Since you want to use a dynamic value for the ID, you concatenate the fixed part ("ID=") with the dynamic part (your variable containing the desired ID).
In your original code, when you called thePrintLabels function, the record to be printed had to be the current record.
I added a parameter, so that the PrintLabels function didn't have to rely on finding or being on the correct record to get the record ID value; the value (ID) was passed to the function.
In Access, the autonumber value for ID is populated after the .ADDNEW command is executed. In SQL server, it is not populated until the record is actually saved. Which is why my method wouldn't work for linked SQL tables as it is currently written.
I pass the ID to the PrintLabels function, instead of relying on the correct record being selected before printing. Same result, different methods.
I should start using Paul's example if getting to ID ....
man,
you guys are good.
thanks!