Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Problem with Form Record Email


Message #1 by "Becky" <RDingwall@m...> on Mon, 25 Feb 2002 12:22:11
Is it not possible just to email one record from a form.  I have code to 

email a whole table as follows but really I just want to email the current 

record of a form?



Kind regards.



Becky



Private Sub Command80_Click()

DoCmd.SendObject acSendTable, "tblCompanies", acFormatXLS, _

"Becky-and-Dave", _

"See What Happens"

Message #2 by "Ian Ashton" <ian@c...> on Mon, 25 Feb 2002 13:14:00 -0000
Becky,



Put a query on the table with a criterion referencing the relevant control

on the form.





Ian Ashton



-----Original Message-----

From: Becky [mailto:RDingwall@m...]

Sent: Monday, February 25, 2002 12:22 PM

To: Access

Subject: [access] Problem with Form Record Email





Is it not possible just to email one record from a form.  I have code to

email a whole table as follows but really I just want to email the current

record of a form?



Kind regards.



Becky



Private Sub Command80_Click()

DoCmd.SendObject acSendTable, "tblCompanies", acFormatXLS, _

"Becky-and-Dave", _

"See What Happens"








Message #3 by "Becky" <RDingwall@m...> on Mon, 25 Feb 2002 13:48:39
> Becky,

> 

> Put a query on the table with a criterion referencing the relevant 

control

> on the form.

> 

> 

> Ian Ashton





*************



Ian how do you do this?

> 
Message #4 by "Ian Ashton" <ian@c...> on Tue, 26 Feb 2002 07:42:27 -0000
Becky,



 I am assuming:

1) There is a Field in your "tblCompanies" is "CompanyID" (this would

normally be the Primary Key)



2) Your form is called "frmCompanyDetails"



3) There is a Text Box Control on "frmCompanyDetails" called "CompanyID"

which either has a data source (bound form) or is populated from (unbound

form) tblcompanies.companyID



Using the above assumptions:



Create a query (called e.g. "qryCompanyDetailsForExport") on "tblCompanies"

which has the fields which you require to export and INCLUDES the field

"CompanyID".



In the criteria row of "CompanyID" place

"[Forms]![frmCompanyDetails]![CompanyID].



Place a command Button on your form and in the "OnClick" event place the

following:



DoCmd.SendObject acSendTable, "qryCompanyDetailsForExport", acFormatXLS, _

"Becky-and-Dave", _

"See What Happens"



Obviously, you can change the various names to suit your project.



Hope this helps,



Ian Ashton







-----Original Message-----

From: Becky [mailto:RDingwall@m...]

Sent: Monday, February 25, 2002 1:49 PM

To: Access

Subject: [access] RE: Problem with Form Record Email





> Becky,

>

> Put a query on the table with a criterion referencing the relevant

control

> on the form.

>

>

> Ian Ashton





*************



Ian how do you do this?

>






Message #5 by "Becky" <RDingwall@m...> on Tue, 26 Feb 2002 10:45:33
Ian



I have done all you say i.e. create the query in the way you stated and 

the button but I am coming up with Debug messages and it does not appear 

to be working, any ideas?



Becky
Message #6 by "Ian Ashton" <ian@c...> on Tue, 26 Feb 2002 11:11:11 -0000
Becky,



What line of code is giving you the error and what is the debug message?



Ian





-----Original Message-----

From: Becky [mailto:RDingwall@m...]

Sent: Tuesday, February 26, 2002 10:46 AM

To: Access

Subject: [access] RE: Problem with Form Record Email





Ian



I have done all you say i.e. create the query in the way you stated and 

the button but I am coming up with Debug messages and it does not appear 

to be working, any ideas?



Becky




Message #7 by "Becky" <RDingwall@m...> on Tue, 26 Feb 2002 12:30:20
Runtime Error 2455 

You entered an expression that has an invalid reference to the Property Is 

Invisible.



Do you know what this means everything seems to be called by the correct 

names so I do not know what it is going on about!



Becky
Message #8 by "Ian Ashton" <ian@c...> on Tue, 26 Feb 2002 20:22:59 -0000
Becky,



OOPS!!!



My apologies. I FORGOT to change "acSendTable" to "acSendQuery" in my post.



The line SHOULD Read:



        DoCmd.SendObject 

        acSendQuery, "qryCompany", acFormatXLS, _

        "RDingwall@m...", _

        "See What Happens"





Ian



-----Original Message-----

From: Becky [mailto:RDingwall@m...]

Sent: Tuesday, February 26, 2002 12:30 PM

To: Access

Subject: [access] RE: Problem with Form Record Email





Runtime Error 2455 

You entered an expression that has an invalid reference to the Property Is 

Invisible.



Do you know what this means everything seems to be called by the correct 

names so I do not know what it is going on about!



Becky





  Return to Index