Command Button to open Form

J

Joe

Ok...

Let me see what the best way to say this. I have a Clients table and a
Services table. on my Clients form I need to add a command button to open my
Services form but the ID from the my Clients table does not appear on my
Services table. The forms link perfectly if the ID already exists on the
Clients table. However, when I enter a new client and try to open the
services form the Client ID does not appear on my Services form.

CLI_ID PK on Clients, SER_ID PK on Services and CLI_ID SK on Services. Any
suggestions or ideas would be helpful.
 
A

Arvin Meyer [MVP]

Joe said:
Ok...

Let me see what the best way to say this. I have a Clients table and a
Services table. on my Clients form I need to add a command button to open
my
Services form but the ID from the my Clients table does not appear on my
Services table. The forms link perfectly if the ID already exists on the
Clients table. However, when I enter a new client and try to open the
services form the Client ID does not appear on my Services form.

CLI_ID PK on Clients, SER_ID PK on Services and CLI_ID SK on Services.
Any
suggestions or ideas would be helpful.

So what you need to do is to first save the record, then open using the
record. There will be a blank record in the Services form. Set the
DefaultValue property of the ClientID textbox in the Services form to:

=Forms!FormNameForClients!ClientID

Now you should be able to sync them at the next opening.
 
J

Joe

Hello Arvin,

I try that and the client id does not appear on the services form after its
saved. I'm working around it by having the Services form as a subform on the
clients table. I didn't want that because the Services table needs a subform
for ServicesDescriptions.
 
J

John W. Vinson

I didn't want that because the Services table needs a subform
for ServicesDescriptions.

Why?

Do be aware that you can use a Query joining Services to ServicesDescriptions.
Properly handled it would be updateable (unless each service has multiple
descriptions).
 
A

Arvin Meyer [MVP]

Joe said:
Hello Arvin,

I try that and the client id does not appear on the services form after
its
saved. I'm working around it by having the Services form as a subform on
the
clients table. I didn't want that because the Services table needs a
subform
for ServicesDescriptions.

Hi Joe,

John's solution will work. You can also nest subforms if needed, but at a
performance hit. I have to wonder why, however, that the ClientID doesn't
appear on the services form. You can add it and set the Visible property to
No. If you don't, and don't use it as a link, the form will not fill in the
underlying Services table with the ClientID.
 

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

Similar Threads


Top