OnClick button - adds a specific field value from the form to another table

  • Thread starter Thread starter Melanie S. via AccessMonster.com
  • Start date Start date
M

Melanie S. via AccessMonster.com

Is there a way to have the value from a specific field in current form copied
to a field of another table?
 
Melanie,
Try an "Update" query to enter the data into another table. You'll need
some unique key value relationship between the other table and the form you
are working on... like CustomerID are the same, or InvoiceNo are the same...
etc.
In your Update query you'll refer to the value on the form as... (use
your names)
=Forms!YourForm!YourTextField
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
aie, sorry for the stupid questions =] but where do I write ' =Forms!
YourForm!YourTextField ' in the update query? and how do I insert it in my
form? thanks for the help =)
 
Melanie,
Are you "Appending" a brand new value to table2, or are you trying to
"Update" a specific record that already exists in table2?
If Updating... then what is your unique key field on the form where the
Update originates... and what is the unique "linked" or related field in
table2?
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Melanie S. via AccessMonster.com said:
aie, sorry for the stupid questions =] but where do I write ' =Forms!
YourForm!YourTextField ' in the update query? and how do I insert it in my
form? thanks for the help =) ----------------------------------------------
 
Ok I will explain more about my situation..

I have created a form (based on a query) for adding new records.
On the form there are these fields:

GuestID (Autonumber)
RoomID
Name
Address
DateIn
DateOut
etc...

I have two other tables which both contain field GuestID.
I want to make it such a way that when I click on the 'Add Record' button,
the value of GuestID is added in the other two tables as well..
 
What information about GuestID are you storing in your other 2 tables, and
what purpose does it serve???

I can't answer your question without understanding what you're trying to do
with these tables, and why it's necessary to be copying GuestID values to
other tables... rather than just link those tables with a One to Many
relationship through the GuestID.

Let's say you kept a series of RoomServicec transactions for a guest's bill.
You would create a table called RoomSvc, and link them (create a
realtionship) to your Guest table via the unique GuestID. There would never
be a need to copy guest information to the RoomSvc table, because they are
related via the link. Each RoomSvc record has the appropriate GuestID
associated to it, during any new record entry, in the RoomSvc table
automatically due to the relationship... you never have to copy it or enter
it yourself.

Your guest information should be on the main form, and the RoomSvc
information would be on a subform of that form. One guest... Many
RoomService transactions. When a guest arrives, you create a new record for
them, and... as they use Room Services, you add those transactions to the
subform.
 
hmm.. I think my table structure wasn't good - I made another one and it's ok
now.. thanks for help =)


Al said:
What information about GuestID are you storing in your other 2 tables, and
what purpose does it serve???

I can't answer your question without understanding what you're trying to do
with these tables, and why it's necessary to be copying GuestID values to
other tables... rather than just link those tables with a One to Many
relationship through the GuestID.

Let's say you kept a series of RoomServicec transactions for a guest's bill.
You would create a table called RoomSvc, and link them (create a
realtionship) to your Guest table via the unique GuestID. There would never
be a need to copy guest information to the RoomSvc table, because they are
related via the link. Each RoomSvc record has the appropriate GuestID
associated to it, during any new record entry, in the RoomSvc table
automatically due to the relationship... you never have to copy it or enter
it yourself.

Your guest information should be on the main form, and the RoomSvc
information would be on a subform of that form. One guest... Many
RoomService transactions. When a guest arrives, you create a new record for
them, and... as they use Room Services, you add those transactions to the
subform.
Ok I will explain more about my situation..
[quoted text clipped - 12 lines]
I want to make it such a way that when I click on the 'Add Record' button,
the value of GuestID is added in the other two tables as well..
 

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

Back
Top