Current record from form

  • Thread starter Very Basic User
  • Start date
V

Very Basic User

Hoping you can help...

I'm trying to start to just get a report to generate on the close of a form.
I can get the report containing all records, but have struggled to see only
the record that I'm on when I close. My code is as follows...


Private Sub Form_Close()
DoCmd.OpenReport "Mail Option Report", acPreview
Reports![Mail Option Report].Filter = "Why - Why Number = " & Me![Why - Why
Number]
Reports![Mail Option Report].FilterOn = True

End Sub


I get the following error message when I try to get it to work...

Syntax error (cissing operatro) in query expression ‘(Why – Why Number = 24)’


The # 24 in the Control section is the first record in the form. I get the
same message even if I'm in a different record.

Please help!
 
K

KARL DEWEY

but have struggled to see only the record that I'm on when I close.I do not follow what you are doing in the code but once you close the form,
your first action, the data therein is no longer available.
--
KARL DEWEY
Build a little - Test a little


Very Basic User said:
Hoping you can help...

I'm trying to start to just get a report to generate on the close of a form.
I can get the report containing all records, but have struggled to see only
the record that I'm on when I close. My code is as follows...


Private Sub Form_Close()
DoCmd.OpenReport "Mail Option Report", acPreview
Reports![Mail Option Report].Filter = "Why - Why Number = " & Me![Why - Why
Number]
Reports![Mail Option Report].FilterOn = True

End Sub


I get the following error message when I try to get it to work...

Syntax error (cissing operatro) in query expression ‘(Why – Why Number = 24)’


The # 24 in the Control section is the first record in the form. I get the
same message even if I'm in a different record.

Please help!
 
V

Very Basic User

I'm trying to have the current record that I'm looking at in the form become
available to E-mail in a report fassion. What will eventually happen is that
each time a user updates a record in the form, an e-mail will be sent to a
gatekeeper automatically when they close the form
--
Thank you for your time!
John


KARL DEWEY said:
I do not follow what you are doing in the code but once you close the form,
your first action, the data therein is no longer available.
--
KARL DEWEY
Build a little - Test a little


Very Basic User said:
Hoping you can help...

I'm trying to start to just get a report to generate on the close of a form.
I can get the report containing all records, but have struggled to see only
the record that I'm on when I close. My code is as follows...


Private Sub Form_Close()
DoCmd.OpenReport "Mail Option Report", acPreview
Reports![Mail Option Report].Filter = "Why - Why Number = " & Me![Why - Why
Number]
Reports![Mail Option Report].FilterOn = True

End Sub


I get the following error message when I try to get it to work...

Syntax error (cissing operatro) in query expression ‘(Why – Why Number = 24)’


The # 24 in the Control section is the first record in the form. I get the
same message even if I'm in a different record.

Please help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top