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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More trouble with getting data into email

Status
Not open for further replies.

Terkle

Technical User
Jul 22, 2007
18
0
0
Hi there

I’m entering text into an email by using a query but I can’t get it to select the data from the loaded form. I think it has something with the ‘MoveNext, MoveFirst etc instruction but I don’t understand these well enough to make it work. I also suspect I may need a loop statement but am not sure how to set this up. The form has a reference number and if I make the criteria in the query the loaded form, the query works fine but I can’t get the information into the email. The code I am using is below:

Set db = CurrentDb()
Set rst = db.OpenRecordset("qry06bNSDEmail")
With rst

strCostCentre = .Fields("CostCentre")
strSubLevel = .Fields("SUBLevel")

.MoveNext

End With

To get the text into the email I am using phrases like:

strEmail = “Cost Centre:” & “ “ & strCostCentre _
& “Level” = & “ “ & strSubLevel etc
This populates the fields but unfortunately, not with the correct data so I presume I need to tell it to loop until it finds the correct entry.

I hope someone may be able to help me with this.

Thanks

Terk
 
What is the correct entry you are looking for?

Have you considered something like:

Code:
Set rst = db.OpenRecordset( _
"SELECT * FROM qry06bNSDEmail WHERE TheKey=" & Me.TheKey)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top