-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You could also create a query that gets all the data from the
different tables you want and set the Form's RecordSource property to
that query. Then just bind the controls to the columns in the query.
==
[Unbound form]
You could have a function in each Controls' ControlSource that returns
the results of the SQL statement. E.g.:
ControlSource: =GetDate()
And the function:
== air code ==
Function GetDate()
Dim strSQL As String
strSQL = "SELECT InvDate FROM Invoices " & _
"WHERE OrderDate = Date() AND OrderID = " & Me!txtID
Dim db As DAO.Database
Dim rs AS DAO.Recordset
Set db = CurrentDB
Set rs = db.OpenRecordset(strSQL)
GetDate = rs(0)
rs.Close
db.Close
End Function
== end air code ==
You'd need to make separate functions for each Control.
You could also use the domain function DLookup(), which is slower than
a recordset retrieval.
HTH,
MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBP7lsXYechKqOuFEgEQIdTQCff+Wrye6bMaifywAXgQ7pHu PfDakAoNS7
va3SWUw+CxenNcWDWIpoQRWc
=uCTm
-----END PGP SIGNATURE-----
Dave wrote:
Hello,
I've been waisting tons of time on this, so I'll just ask and
hopefully someone will be able to help.
I am opening an excel document and placing values into it's
"letterhead" section (i have no problem doing this).
The values that I am writing to the excel document come from a couple
different tables.
I am displaying the set of values on a form for the user to see. once
they approve and click a button, the code takes those values in the
textboxes and writes them to the excel document.
I have not set the recordsource property for the form, cause its not
like its actually updating any records or anything, but I am having
difficulty running simple select queries for the textboxes. I have
been trying to specify a query in the Control Source, but that is
wrong.
So, in summary, I would like to know how to associate a SELECT query
to a textbox on a form with no record source.
Any suggestions would be greatly apprechiated!
Thanks,
Dave