Filling in a Textbox without a Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After many posts, I could not get a simple answer on how to do this. My
co-worker actually figured it out and I thought I would share it.

Here's the code:

Dim First As String

strsql = "Select * from TempTransferAverage where TransferMonth = 10 and
TransferYear = 2004"
Set Oct2004 = CurrentDb.OpenRecordset(strsql)
First = Oct2004!TransferAverage
Me!Text587.ControlSource = "=" + First

Thanks all for your attemps at helping me.
~Elena
 
Seems to be a more complex way than you would normally need. A DLookup
function will do this in one simple step, and you can use it as the
ControlSource expression for a textbox:

=DLookup("TransferAverage", "TempTransferAverage", "TransferMonth = 10 And
TransferYear=2004")
 
Back
Top