form loads with result of query

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

Guest

I need the results of a query displayed when form is loaded. I've seen the
sql statement to do this BUT only one (1) table is used for the query ... I
need to join two(2) tables in my query. I think the "set rs = dbEndgine
......" statement allows reference to one(1) table only. What is the
syntax I need to run this query with 2 tables?


Thanks for any suggestions.
 
You can create the query with t he query builder that joins the tables the
way you want them, then reference the query name when you open the form. I
am a little confused. Is this the record source for the form, or a recordset
you are using for other purposes once the form is already open?

If it is the record source, just use the name of the query in the form's
records source property. If it is another recordset you want to use:

Set rst = CurrentDb.Openrecordset("QueryNameGoesHere")
 
O.K. But how to I get the result to display on the form in an unbound text
box that is named "txtqryResult"; i.e. txt.qryResult = ????

The query uses 2 tables; 1 is the record source for the form, 2nd is a table
used on a different form.
 
I want it to display when the form is loading.

It also displays the new value based on the selection of a drop down, but I
already have that part working with " txtqryResult=fieldname.column(1)"
 
Back
Top