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 / July 2007

Tip: Looking for answers? Try searching our database.

Problem getting a form to open to a related record.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
firecop1 - 27 Jun 2007 16:28 GMT
I have a button on a form called "MainForm" that when clicked I want to open
another form which should show all "Rental" records relating to the location
on the "MainForm"

In my MainTable which is what the MainForm" is populated by I have a field
called ListingID (which is also my keyfield and as such is an AutoNumber).

In my "Rental" table I have a field called "PremID" which is a number field
that I want to use to tie the records into the MainTable.
(I will be using the same field name in other tables to link them to the
MainTable as well).

I am confused as to how and where to setup whatever needs to be done to open
the Rental form filtered to the record (or if there are no records at a new
record). I tried when creating the button using the macro to choose form
operation then open form then chose my Rental form then "open the form and
find specific data to display" but when it gets to the select fields that
contain matching data I can chhose a field from the Rental table but nothing
appears under the main table (no fields whatsoever).

Perhaps I need another field in my main table to use as a linking field?

Any help would surely be appreciated here and as always thanks in advance
for your help.

Andrew J. Brofman
Chief Fire Marshal
Lake Grove, NY
jahoobob - 27 Jun 2007 16:51 GMT
You will probably be best served if you show your Rental records in a subform
(Continuous) on the MainForm (Single.)  When you place the subform in the
MainForm, select the subform objects Properties and then select "Link Child
Fields" then select the ellipsis (...) at the end of the blank.  You will be
shown a form from which you can select ListingID as the parent and PremID as
the child.
Once this is done, whatever records you enter in the subform will be related
to the record on the MainForm and whatever record you view on the Main will
show all the rental records.

>I have a button on a form called "MainForm" that when clicked I want to open
>another form which should show all "Rental" records relating to the location
[quoted text clipped - 24 lines]
>Chief Fire Marshal
>Lake Grove, NY
firecop1 - 27 Jun 2007 17:22 GMT
I thought about doing this but I already have a continuous subform on the
main form that lits all activities for the location in the specified
records. As I mainly work off a laptop, I dont have the real estate to see
another subform and the rental data only applies to a select number of
locations so it is better suited out of the way. Finally I am going to have
a number of other forms as the databasegrows that will be linked in the same
fashion.

Now if a subform can be hidden until a button is pressed than I guess that
could work but again, real estate is an issue.

> You will probably be best served if you show your Rental records in a
> subform
[quoted text clipped - 46 lines]
>>Chief Fire Marshal
>>Lake Grove, NY
jahoobob - 27 Jun 2007 18:46 GMT
Okay.  Make your new form a popup so that you can leave your MainForm open
and the new one will show up in front of it.  Place this code in the On Click
event of the button to open the new form:
   Dim stDocName As String
   Dim stLinkCriteria As String

   stDocName = "nameofRentalsform"
   stLinkCriteria = "[PremID]=" & Me![ListingID]
   DoCmd.OpenForm stDocName, , , stLinkCriteria

>I thought about doing this but I already have a continuous subform on the
>main form that lits all activities for the location in the specified
[quoted text clipped - 12 lines]
>>>Chief Fire Marshal
>>>Lake Grove, NY
firecop1 - 27 Jun 2007 22:45 GMT
Worked like a charm......
Short and sweet-no where near as difficult as I would have expected it to
be.

Thanks again.

Andy
> Okay.  Make your new form a popup so that you can leave your MainForm open
> and the new one will show up in front of it.  Place this code in the On
[quoted text clipped - 25 lines]
>>>>Chief Fire Marshal
>>>>Lake Grove, NY
missinglinq - 28 Jun 2007 18:22 GMT
Hey, Chief!

Glad you got your problem solved while I was away. Just a couple of thoughts,
since I know you're new at this, and you mentioned having a problem with
"real estate!"

I, too, work primarily in apps that use up a lot of real estate, and have a
couple of  basic strategies I use. The first involves the use of tabbed pages.
Tabbed pages have the advantage of allowing essentially unlimited numbers of
controls without undue crowding, and at the same time allow information to be
grouped logically. One tab, for instance, could have demographic and contact
information for a manufacturing facility, another information on the location
of emergency equipment, standpipes, etc, and another yet a record of
inspections of the facility. And all of these tabbed pages are actually one
form, with the controls on them referenced as if they were all on one "screen.
"  Or you can place subforms on some of the pages. If you ever try to go this
route and have problems, let us know. They're quite handy, and you only have
to know a few things to make them work for you.

The second strategy I use involves magic! Which is to say making things
appear and disappear! You could actually layer several subforms on top of
each other, and by controlling the .Visible property, make only one of them
show at a time, thus saving real estate!

Linq
PaganLinq@Yahoo.com

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

firecop1 - 01 Jul 2007 14:49 GMT
You know, I have seen the Tabs used in Filemaker but did not know that it
could easily be done in Access. That would definately solve my real estate
problems and keep things simple.  I just have to figure out where and how to
set it up.

Are there any examples freely floating around that you know of ?
Or is there a tab wizard in Access 2007?

AS far as the layering of subforms-that sounds WAY out of my league but
again, would keep things to "one" form which I like.

> Hey, Chief!
>
[quoted text clipped - 34 lines]
> Linq
> PaganLinq@Yahoo.com
missinglinq - 01 Jul 2007 18:09 GMT
Hey, Chief!
It's really a breeze, just one or two "gotta know" things. I posted a very
short how-to on another forum and they included it in their tutorials section.
You might want to have a look at some of the other stuff there, too! Scroll
down and look for  "Using Tabbed Pages on a Form."

http://www.thescripts.com/forum/thread632608.html

Have a great (and safe) 4th!

Linq

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

firecop1 - 02 Jul 2007 17:26 GMT
I am reading through it now and I like the concept....

I appreciate all of your help you are truly an Access Master LOL...

Safe holiday to you as well..I am sure I will be busy!!

Andy

> Hey, Chief!
> It's really a breeze, just one or two "gotta know" things. I posted a very
[quoted text clipped - 9 lines]
>
> Linq
 
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



©2009 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.