unbound form subform

I

iccsi

I have an unbound form on the data entry and would like to add a
subform of it.

The Access does not let me link child and mater field, because it is
unbound form.

Are there any work around or I need create a query with paramter from
controls on the unbound form to get sub form data?


Your help is great appreciated,
 
S

scubadiver

If you have a form and subform, then you need two tables and have a
1-to-many relationship.

Primary key field in the main table

an equivalent field in the second table that does not have a primary key

establish a link in the "relationships" view by selecting the primary key
field and dragging it to the other table.
 
J

John Smith

You can link a sub-form to an unbound master form but you have to enter the
link field(s) yourself, the wizard cannot do it. The master fields will be
controls on your unbound form, for the child they will be columns from it's
record source.

HTH
John
##################################
Don't Print - Save trees
 
I

iccsi

You can link a sub-form to an unbound master form but you have to enter the
link field(s) yourself, the wizard cannot do it.  The master fields willbe
controls on your unbound form, for the child they will be columns from it's
record source.

HTH
John
##################################
Don't Print - Save trees




- Show quoted text -

Thanks millions,
 
A

Albert D. Kallal

Absolutely can do this, all you do is simply set this up forms data source
to anything you want.

eg:

let's assume we want the sub form to show all the cities from saying
Edmonton.

dim strSql as string

strSql = "select * from tblCustomer where city = 'Edmonton'"

Me.MySubForm.Form.Reocrdsource = strSql
Are there any work around or I need create a query with paramter from
controls on the unbound form to get sub form data?

as the above shows, you know you have to make a query with parameters, if
you put the params in the query then it'll prompt you (we don't want that).
The above example of code snippet shows that you can actually take values
from the control values entered by the user, and simply use that to make the
sql, and shove it into the sub-form. In the above example I hard coded the
city, but it could have just as well been a text box on the form

strSql = "select * from tblCustomer where city = '" & me.txtcity & "'"

In fact the above is exactly how I made the following search form and you
can see the screen shots here:
http://www.members.shaw.ca/AlbertKallal/Search/index.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top