Terkle
Technical User
- Jul 22, 2007
- 18
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
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