Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing Recordset Values in Project 1

Status
Not open for further replies.

jcg6

Technical User
Feb 18, 2002
50
US
I would like to open a recordest (from a table) and use those values in a variable string. I am using a select * statement from my table to open my recordset.

How can I capture the values of that recordset into a variable? Any info would be much appreciated. Thanks
 
The GetString method of ADO.

Dim cnn As New adodb.Connection
Dim rst As New adodb.Recordset
Dim mySQL as string
Dim myVar as Variant

cnn.Open CurrentProject.Connection

mySQL = "select * from mytable"

rst.Open mySQL, cnn, 3,3

if not rst.EOF Then
myVar = rst.GetString
else
msgbox "no records"
Set rst = Nothing
Set cnn = Nothing
Exit sub or function whatever?
end if

rst.close
cnn.close
Set rst = Nothing
Set cnn = Nothing
 
Thanks for your help on this...I have one additional question for my full solution...

What I am doing is using the SendObject function to send a report to a list of emails - from the table I was referencing earlier.

I want to be able to send a specific page of the report based on an ID Number.

SO, if Employee1 was entering data in a form and clicked send email - it would only send a report for that particular record, not all of the records.

Is there an easy way to do this? Thanks again for your assistance. :)
 
Never mind - I figured it out. Thanks for your help with my original question. [smile]
 
You are welcome. Great that you figured out the 2nd part.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top