Multiple Table selection using form

S

Sikander

Dear all

As i am very much new to MS Access you guys will have to excuse me if i am
talking complete nonsense.

What i want to do is:

Using Form i want to select which table to write a data to.

Say i have got three table named A, B & C.

Now in the form i want to create a List box with three rows: X, Y, & Z.

Now when the user click on X in the list box i want form to refer to Table A.

And then the data typed in the form field should be stored into Table A.

Similarly for B and C.

Can access do this. And if yes how.

All help will be highly appreciated.

Regards
Sikander
 
S

scubadiver

What I have done is:

create three tables

TableA
TableB
TableC

and create a form for each and give them the same names.

Create a form with a subform but don't give the subform a source (The
subform is called 'subformctrl'). On the form create a list box and put in
X,Y,Z.

In the after update event of the list box (called 'list2') I put the
following:

subformctrl.SourceObject = ""

If Me.List2 = "X" Then subformctrl.SourceObject = "TableA"
ElseIf Me.List2 = "Y" Then subformctrl.SourceObject = "TableB"
ElseIf Me.List2 = "Z" Then subformctrl.SourceObject = "TableC"
End If

In theory, the fields in the subform should change depending on the letter
but I get an error with the code and I can't see why.
 
S

Sikander

Thanks for your reply

As i said before, i am very much new to access. So cant quite understand the
concept. Is it possible to send me the table and form you created, so i
understand the concept properly.

Regards
Sikander
 

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