Query Reference

poporacer

Registered User.
Local time
Today, 05:33
Joined
Aug 30, 2007
Messages
136
I have a form that has the data set to a query. On this form I have a text box that I want to combine two fields from the query into one and put that info in the textbox...

There is a textbox on the form txtLName

the fields are LName and FName

the query name is qryAddress
SELECT LName, FName, Address from tblAddress WHERE LName =txtLName
I want something like this:

dim strQuery as STRING
strQuery=qryAddress.LName 'how to reference the fields in a query?
strQuery=strQuery & " " & qryAddress.FName

Any ideas or suggestions?
 
If the form's data is bound to the query, then you do not need to go through those extremes ...

In the QBE where you build the query, pick a blank column. In the first line of the column put in something like:

FullName: [LName] & ", " & [FName]

Now, in the form, pick the control you want to have this data. Bind the source data of the text box to "FullName". It will show up in the list once you have made it in the query and saved the query.

-dK
 
dkinley is right on this.
 

Users who are viewing this thread

Back
Top Bottom