dbTalk Databases Forums  

REQ Help: Adding a record to a table which is related to another table with one record selected

comp.database.ms-access comp.database.ms-access


Discuss REQ Help: Adding a record to a table which is related to another table with one record selected in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peppie
 
Posts: n/a

Default REQ Help: Adding a record to a table which is related to another table with one record selected - 08-29-2006 , 01:09 PM






Hi,

I have a table that contains the address data of my clients. I
have another table that contains project data. It is related to
my clients table. 1 client can have multiple projects.

Now I made a form that shows 1 client at the time and I can
search for clients, add new clients, delete clients (who wants
to do that though) and so on. The form also show a sub-form for
all the projects that belong to one client. Here comes my
question: How can I create a button in my form that adds a
project to the selected client?

Can someone please help?

Regards, Peppie

----------------------------------------------
Posted with NewsLeecher v2.0 Beta 5
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------


Reply With Quote
  #2  
Old   
Ira Solomon
 
Posts: n/a

Default Re: REQ Help: Adding a record to a table which is related to another table with one record selected - 09-06-2006 , 08:27 PM






Hi:
There are any number of ways to do this.

Lets keep it simple. Create a data entry form for the project.

Create a module.
Define one or more global variables e.g.
Global CustNum as long

Do that for any cusotmer fields you want in the project record.

Now add a button to the existing form.
The button will have a few lines of code.
You will assign values from your main form to the globals.
Then open your new form. Open it in dialog mode.
In the open event assign the globals to the field they need to go in.
Fill in the form.
The save button will save the record and close the form, taking you
back to the code in the main form.
You want a line that is something like:
me.subformname.refresh

You should then see the new project in the list.

Yes, this is simple. There are more arcane ways to do it.

Good luck.

Ira Solomon




On 29 Aug 2006 18:09:46 GMT, rpeppel (AT) zonnet (DOT) nl (Peppie) wrote:

Quote:
Hi,

I have a table that contains the address data of my clients. I
have another table that contains project data. It is related to
my clients table. 1 client can have multiple projects.

Now I made a form that shows 1 client at the time and I can
search for clients, add new clients, delete clients (who wants
to do that though) and so on. The form also show a sub-form for
all the projects that belong to one client. Here comes my
question: How can I create a button in my form that adds a
project to the selected client?

Can someone please help?

Regards, Peppie

----------------------------------------------
Posted with NewsLeecher v2.0 Beta 5
* Binary Usenet Leeching Made Easy
* http://www.newsleecher.com/?usenet
----------------------------------------------

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.