Thanks a lot Allen,
I now have a combo box and a list box in my form
combo1 - Row Source Table/Query
SELECT MSysObjects.Name FROM MSysObjects WHERE (((Left([Name],4))<>"MSys")
And ((MSysObjects.Type)=1 Or (MSysObjects.Type)=6)) ORDER BY
MSysObjects.Name;
After update of this I have:
Dim db As Database
Dim tdf As TableDef
Dim fld As Field
Dim strRecSource As String
Set db = CurrentDb()
Set tdf = db.TableDefs(Me.Combo1)
For Each fld In tdf.Fields
strRecSource = strRecSource & fld.Name
strRecSource = strRecSource & "; "
Next
strRecSource = Left(strRecSource, Len(strRecSource) - 2)
Me.Combo2.RowSource = strRecSource
Me.Refresh
combo2 is a multi select list Box, where I can select more than one
available field.
Now, how I can have a query returning those selected fields?
GeorgeCY
Ο χÏήστης "Allen Browne" ÎγγÏαψε:
Use something like this as the RowSource of a combo/list box to list of
the
tables in your database:
SELECT MSysObjects.Name FROM MSysObjects
WHERE ((MSysObjects.Name Not Like "~*")
AND (MSysObjects.Type In (1,4,6,8)))
ORDER BY MSysObjects.Name;
To list the fields in a table, set the RowSourceType of another combo to
Field List.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Thanks a lot both of you.
1. Examples supplied by Tom are very useful, but as mentioned before -
is
there any way to show a map? of all tables/fields in a form so the user
can
tick on any field and this to be included in the results of a query?
2. Since I will lock the database (the user will not be able to see or
create queries), How can I let the user create the required query?
GeorgeCY
Ο χÏήστης "Allen Browne" ÎγγÏαψε:
If you know nothing about code, the simplest solution would be to let
the
user create a query, using whatever fields they want.
Alternatively, you could create a form that has all the columns in
Datasheeet view. Then set the ColumnHidden property of the controls
you
wish
to hide in (say) Form_Open.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Dear friends,
I have a relational database (Access 2003) and I need the user to be
able
to
select some fields from one or more tables to be included in a
query,
using a
form (The user will not have permissions for
viewing/creating/mmodifying
tables, queries etc).
i.e. a sample of tables:
tbl_Employees (EmployeeID primary key, employeeName,
EmployeeSurname,
dateofBirth, TelNos, Address fields etc)
tbl_EmployeesTransfers (TransferDate and BranchID primary keys)
The user must be able to see all those fields and he may wants to
use
only
the EmployeeID and the TransferDate to be shown in a query.
Any help will be highly appreciated.
Thanking you in advance,
GeorgeCY