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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link one form to many table???

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
586
GB
Hi there - I have a database with hundreds of tables (rach table has the same layout).

I want to be able to open a form which then links to a table.

For example: 10 cars each have there own ID and there own table:

Car 1 - ID 1, Table name "1"
Car 2 - ID 2, Table name "1"
Car 3 - ID 3, Table name "1"
Car 4 - ID 4, Table name "1"

I intend to have one form showing a list of cars and then click on it to open the required form and table.

What code do i use to set the forms control source to say table 4 when it opens.

Many thanks

Mark



 
Have a look at the RecordSource property of the form object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes it's the record source that i want to set - how can i do this ? Can i use setvalue??
 
I don't know what setvalue is (a macro action ?)
I'd use VBA:
DoCmd.OpenForm "FormNameHere"
Forms![FormNameHere].RecordSource = "Table4"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
10 cars each have there own ID and there own table
If you normalized the database so all cars are in the same table, you could simply open the form and filter by car ID.

 
I know, but it's a professionally written program with over 1500 tables in it - so i'm kinda stuck with the format.

The line:

Forms![FormNameHere].RecordSource = "Table4"

Gives an error - "Method Item of object "Forms" failed

Any ideas - Thanks
 
What is your REAL code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How can each car have there own table when all 4 cars have the same table name?
Did you miss say table and mean row?
Or are the table names not all "1"?

Why would a "professional" program generate a separate table for each car?

ck1999

 
Why would a "professional" program generate a separate table for each car?
[/CODE]

Because (unfortunately) "professional" is not necessarily synonymous with "well designed". :)

Ed Metcalfe

Please do not feed the trolls.....
 
Stupid me -

Car 1 - ID 1, Table name "1"
Car 2 - ID 2, Table name "2"
Car 3 - ID 3, Table name "3"
Car 4 - ID 4, Table name "4"


QUOTE]
Why would a "professional" program generate a separate table for each car?
[/CODE]

Can't answer that one - but that's the way it is - and of it's type it's one of the countrys most sucessful packages (in terms of end users).

Apprecaite the input guys...

The code I am using is....

Private Sub Command22_DblClick(Cancel As Integer)
DoCmd.OpenForm "transactions form"
Forms![transactions form].RecordSource = "table1100
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top