Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is it possible to make a form that dynamically selects one or more...

Status
Not open for further replies.

Eric6

Programmer
Jun 11, 2002
54
CA
hello,

i need to make a form that can select either one of 2 tables as its source.
i'm passing the table's name from a previous form (formA) as an argument of the openform method. I dont know how to tell formB to use that table (argument from formA) as its source...
i dont even know if that's possible

so my questions are:
- how do i dynamically select the source of a form (using an argument from a previous form)
and
- i would also like to know how to make a form that allows the user to select some tables from a list and generate a report out of the selected tables only (i'm guessing i would have to use a query containing all the possible data and then filter it to generate the report)
if this is correct, how do i make a form that allows the user to select the filters to a report?

i know i'm asking alot, but any help would be greatly appreciated...
thank you in advance
 
On the calling form, put this:

DoCmd.OpenForm "YourSecondForm"

If YourCondition Then
Forms!YourSecondForm.RecordSource = "Table1"
Else
Forms!YourSecondForm.RecordSource = "Table2"
End If

Forms!YourSecondForm.Requery Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
hi
i've been working on it
the form selects the proper table
(i can tell from the number of records that are available
depending on which button i chose)

however, my field is not display the contents of the table
its always blank not matter what record i go to...

if i select a recordsource for my text field
(in access design mode)
i can only see the values for the table i selected in
the property box...

if i click the second button, the proper table is loaded(like i said, i can tell by the number of records it has)
but the field wont display the proper values
i get a "#Name?" error
i tried to refresh the form
i tried to requery the form
i tried refresh and requery from formA too
but no luck

does any one have an idea how i could get this to work?
 
I assumed you had 2 tables that were the same. I am confused on why you would want to have a single form with 2 different "Setups". What is the purpose of having a single form with controls bound to different fields dynamically. Why don't you just create 2 forms, each with it's own record source, and open the one you want based on your first form's criteria? Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
sorry for being unclear :)
i have 2 "list" tables (single field tables)
- the first is called project list (listing projects)
- the second is called function list (listing functions)
they both only contain one column and they both have the same name ("name")

i'm making a form to enable the user to update these lists
(because they are used in drop down boxes)
i figure theres no point in making 2 forms for 2 identical tables...

my problem though is that i cant make the form switch
table (as its source)
depending on which button you push (maintain functions or maintain projects) the user is taken to the form and that form should use the proper table as its source...

the table is properly selected (like i said, i can tell by the number of records the form "sees")
but i cant get the form to display the values in the textbox....
my navigation buttons (the ones i made) work but i get
a #Name? in my text box...

i tried to requery the from onload but it didn't help...
does anyone know what i'm doing wrong?

thanks
 
First you need to change the names of the fields in the tables. "Name" is an Access keyword, and can cause problems when you are trying to display data. Don't know if it will solve the problem, but should be done anyway. Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top