Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

unbound form subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
iccsi - 23 May 2008 15:09 GMT
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,
scubadiver - 23 May 2008 15:39 GMT
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.

> I have an unbound form on the data entry and would like to add a
> subform of it.
[quoted text clipped - 6 lines]
>
> Your help is great appreciated,
John Smith - 23 May 2008 16:45 GMT
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 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?
iccsi - 23 May 2008 20:06 GMT
On May 23, 11:45 am, John Smith
<johnDOTsmithATbromleyhospitalsDOTnhsDOTuk> wrote:
> 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
[quoted text clipped - 14 lines]
>
> - Show quoted text -

Thanks millions,
Albert D. Kallal - 23 May 2008 20:53 GMT
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

Signature

Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.