Not sure I understand this question.
The form's RecordSource property is a string. The string needs to be a
valid
SQL statement (or the name of a table or query.)
If it is a simple string, just type it straight into the Properties box
in
the RecordSource property.
If you would like the query builder to help you, click the Build button
(...) beside the property, and design the query graphically.
If the query statement needs to change based on other circumstances (such
as
which criteria boxes the user entered something in, or selectively using
a
subquery to limit the form to matching records in another table), then
you
will want to use VBA code to create the string and assign it at runtime.
Hi Allen
Thanks for the link to the cboSelector....I am using it already to
select
internal and external phone numbers using lastnamefirst.
One question I wondered about....what is the difference between using
vba
in
the record source property and entering it in the vba editor....it
woiuld
seem to achieve the same goal but there must be a difference...would it
be
that the record source property is limited to a small code size?
:
You can display the surname + first name in the combo by concatenating
the 2
fields in the RowSource property of the combo.
Assuming your table has an AutoNumber primary key field named ID, you
might
set the combo's RowSource to something like this:
SELECT ID, LastName & " " & FirstName AS FullName
FROM [Contact Numbers] ORDER BY LastName, FirstName
Other propertiers for the combo:
Column Count 2
Column Widths 0
Control Source {leave this blank!}
It sounds like you want to use this combo to move to the record for
the
names selected. If so, see:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html
If I have a Flat table "Contact Numbers" (No Relationships)
Which has within it fields "FirstName" and "LastName"
I am using an SQL statement to concatenate both of the above name
fields
as
"LastName First" separated by a comma.....ie..Bloggs, Joe
How do I incorporate the "LastName First" field into a combobox
control,
so
that when I click on a name in the dropdown list, it returns the
selected
individuals contact Details in either a Labels or Text boxs on the
form,
or
any other recommended way of returning the contact details from the
described
combobox?