Recordset

  • Thread starter auujxa2 via AccessMonster.com
  • Start date
A

auujxa2 via AccessMonster.com

I'm trying to use a field from a query as a recipient of an automated lotus
email. Please help. Here is the piece of relevant code
thank you in advance

Dim rst As DAO.Recordset


Set rst = CurrentDb.OpenRecordset("SELECT Allocator FROM ToFieldQry")

EmailSendto = rst
 
M

MGFoster

auujxa2 said:
I'm trying to use a field from a query as a recipient of an automated lotus
email. Please help. Here is the piece of relevant code
thank you in advance

Dim rst As DAO.Recordset


Set rst = CurrentDb.OpenRecordset("SELECT Allocator FROM ToFieldQry")

EmailSendto = rst

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You can use the FollowHyperlink method if Lotus is your default email
client.

Application.FollowHyperlink "mailto:" & rst(0)

"mailto:" is the prosign that indicates the following data is an email
address & the default email client should be used to open an email form.

rst(0) means use the data in the 1st column (Allocator).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSTheOIechKqOuFEgEQI2IACfUPRm4REa+Q06NFZkWUpkqfH3dMIAnjwJ
lhNUQU7qvsEpEp+MIOJgbLtq
=PVIn
-----END PGP SIGNATURE-----
 
A

auujxa2 via AccessMonster.com

I get an error message when defining the rst. (too few parameters, expected 1)


Set rst = CurrentDb.OpenRecordset("SELECT Allocator FROM ToFieldQry")
I'm trying to use a field from a query as a recipient of an automated lotus
email. Please help. Here is the piece of relevant code
[quoted text clipped - 5 lines]
EmailSendto = rst

You can use the FollowHyperlink method if Lotus is your default email
client.

Application.FollowHyperlink "mailto:" & rst(0)

"mailto:" is the prosign that indicates the following data is an email
address & the default email client should be used to open an email form.

rst(0) means use the data in the 1st column (Allocator).
 
J

John W. Vinson

I get an error message when defining the rst. (too few parameters, expected 1)


Set rst = CurrentDb.OpenRecordset("SELECT Allocator FROM ToFieldQry")

Did you perchance look at the Help for OpenRecordset?

Try

Set rst = CurrentDb.OpenRecordset("SELECT Allocator FROM ToFieldQry",
dbOpenDynaset)

all on one line.
 
A

auujxa2 via AccessMonster.com

When I hover over dbOpenDynaset, I reads '2'. When I hover over rst, it
gives me 'nothing'
 
B

Bob Barrows

auujxa2 said:
I get an error message when defining the rst. (too few parameters,
expected 1)


Set rst = CurrentDb.OpenRecordset("SELECT Allocator FROM ToFieldQry")

This typically means you have misspelled a field or table name. So a
field called Allocator can't be found in a table/saved query called
ToFieldQry.
 
J

John W. Vinson

When I hover over dbOpenDynaset, I reads '2'.

Exactly. That's the value of the builtin constant.
When I hover over rst, it
gives me 'nothing'

Exactly. You haven't executed the statement so the rst variable has not been
assigned.

Try selecting the keyword OpenRecordset and hit the F1 key to get help on the
topic.
 
A

auujxa2 via AccessMonster.com

I couldn't figure it out, because the field and query were spelled correctly.
So I decided to just use the table name instead of the query, and it worked
fine. Thank you for your time
 
J

John W. Vinson

I couldn't figure it out, because the field and query were spelled correctly.
So I decided to just use the table name instead of the query, and it worked
fine. Thank you for your time

Glad it's working. I might have been able to be more helpful had you posted
the actual code and the nature of the problem you were experiencing.
 
D

David W. Fenton

Did you perchance look at the Help for OpenRecordset?

Try

Set rst = CurrentDb.OpenRecordset("SELECT Allocator FROM
ToFieldQry", dbOpenDynaset)

all on one line.

The option for the recordset type is not required, and dbOpenDynaset
is the default.
 

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