|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
I have a form with invoice data and would like to print a report with a button on the form. My problem is I don't know how to tell the report to print for the current record's invoice number.
Any help would be great. Thanks ahead Maureen
|
|
On 26 Jul 2006 18:56:29 -0700, Maureen227 wrote:
[Quoted Text] > I have a form with invoice data and would like to print a report with a > button on the form. My problem is I don't know how to tell the report > to print for the current record's invoice number. > > Any help would be great. Thanks ahead > Maureen
Assuming the Invoice number is a unique prime key field and is a Number datatype, not text:
DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " & Me![InvoiceNumber]
If [InvoiceNumber] is text, then use:
DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '" & Me![InvoiceNumber] & "'"
-- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
fredg wrote:
[Quoted Text] > On 26 Jul 2006 18:56:29 -0700, Maureen227 wrote: > > > I have a form with invoice data and would like to print a report with a > > button on the form. My problem is I don't know how to tell the report > > to print for the current record's invoice number. > > > > Any help would be great. Thanks ahead > > Maureen > > Assuming the Invoice number is a unique prime key field and is a > Number datatype, not text: > > DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " & > Me![InvoiceNumber] > > If [InvoiceNumber] is text, then use: > > DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '" > & Me![InvoiceNumber] & "'" > > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail
Fred This work great. Thanks a Terabyte. My in voice number was a text box and i was using the code for a number field. Maureen
|
|
this works great, however - how can we capture any new data on this form - not showing up when the button is pushed. Thanks,
"fredg" wrote:
[Quoted Text] > On 26 Jul 2006 18:56:29 -0700, Maureen227 wrote: > > > I have a form with invoice data and would like to print a report with a > > button on the form. My problem is I don't know how to tell the report > > to print for the current record's invoice number. > > > > Any help would be great. Thanks ahead > > Maureen > > Assuming the Invoice number is a unique prime key field and is a > Number datatype, not text: > > DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " & > Me![InvoiceNumber] > > If [InvoiceNumber] is text, then use: > > DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '" > & Me![InvoiceNumber] & "'" > > -- > Fred > Please respond only to this newsgroup. > I do not reply to personal e-mail >
|
|
On Wed, 23 Aug 2006 15:17:01 -0700, Bon43 wrote:
[Quoted Text] > this works great, however - how can we capture any new data on this form - > not showing up when the button is pushed. > Thanks, > > "fredg" wrote: > >> On 26 Jul 2006 18:56:29 -0700, Maureen227 wrote: >> >>> I have a form with invoice data and would like to print a report with a >>> button on the form. My problem is I don't know how to tell the report >>> to print for the current record's invoice number. >>> >>> Any help would be great. Thanks ahead >>> Maureen >> >> Assuming the Invoice number is a unique prime key field and is a >> Number datatype, not text: >> >> DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = " & >> Me![InvoiceNumber] >> >> If [InvoiceNumber] is text, then use: >> >> DoCmd.OpenReport "ReportName", acViewPreview, , "[InvoiceNumber] = '" >> & Me![InvoiceNumber] & "'" >> >> -- >> Fred >> Please respond only to this newsgroup. >> I do not reply to personal e-mail >>
Newly entered data in a form is not saved until you close the form, move to another record, or explicitly tell it to save the record.
Add one line of code to the command button click event to first save the record:
DoCmd.RunCommand acCmdSaveRecord DoCmd.OpenReport "Reportname", etc...... -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
|