Manipulating data in another table with a Form

C

Chip

Howdy from Oklahoma!!!

I am relatively new to ACCESS and trying not to ask too many questions here
but I have got one that I cant figure out. I apologize if this is POSTED
twice on this Newsgroup as when I sent the first Questioon it just
disappeared and I did not receive a confrimation that it got sent.

I need a button on a form [frm_PO] to append (add) a new record in another
table [tbl_Inventory] that is NOT the data source for the form. BUT the
fields that I need to use to add the new record in [tbl_Inventory] are on the
form [frm_PO]. (i may need to add that I made sure that one of the fields
being copied from the form is the "Primary Key" of [tbl_Inventory]) This is
being done to receive in Materials from a Purchase Order (also in this
database) into my Inventory (tbl_Invnetory) and the 2 fields being
transferred will be (Part#) and (Quantity).

I also need another button to just add the quantity "received Quantity" from
the frm_PO to an existing record of the Part# if the record is already in
"tbl_Inventory". ( I have gotten the "logic" built to identify if the record
is already there in the table for that Part# or if it is needed to be added
because it is not there, I just cannot figure out how to do the actual
manipulation of the other table (tbl_Inventory).

As Always, THANKS IN ADVANCE!!!
Chip
 
L

Lynn Trapp

Chip,
You'll need to use the following command behind in the click event of your
button:

Dim sqlInsertQueryStm As String

sqlInsertQueryStm = "Insert Into YourTable Values( " & Me.txtFieldFromForm &
";"
DoCmd.RunSQL sqlInsertQueryStm

Obviously, the insert statement will be a lot more detailed than that, but
this should get you started. Take a look at Help for Action Queries and VBA
Help for the RunSQL command.



--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html
 
C

Chip

THANKS A MILLION!!!
Ths is the direction I was needing!!!

THANKS AGAIN!!!
Chip

Lynn Trapp said:
Chip,
You'll need to use the following command behind in the click event of your
button:

Dim sqlInsertQueryStm As String

sqlInsertQueryStm = "Insert Into YourTable Values( " & Me.txtFieldFromForm &
";"
DoCmd.RunSQL sqlInsertQueryStm

Obviously, the insert statement will be a lot more detailed than that, but
this should get you started. Take a look at Help for Action Queries and VBA
Help for the RunSQL command.



--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Chip said:
Howdy from Oklahoma!!!

I am relatively new to ACCESS and trying not to ask too many questions
here
but I have got one that I cant figure out. I apologize if this is POSTED
twice on this Newsgroup as when I sent the first Questioon it just
disappeared and I did not receive a confrimation that it got sent.

I need a button on a form [frm_PO] to append (add) a new record in another
table [tbl_Inventory] that is NOT the data source for the form. BUT the
fields that I need to use to add the new record in [tbl_Inventory] are on
the
form [frm_PO]. (i may need to add that I made sure that one of the fields
being copied from the form is the "Primary Key" of [tbl_Inventory]) This
is
being done to receive in Materials from a Purchase Order (also in this
database) into my Inventory (tbl_Invnetory) and the 2 fields being
transferred will be (Part#) and (Quantity).

I also need another button to just add the quantity "received Quantity"
from
the frm_PO to an existing record of the Part# if the record is already in
"tbl_Inventory". ( I have gotten the "logic" built to identify if the
record
is already there in the table for that Part# or if it is needed to be
added
because it is not there, I just cannot figure out how to do the actual
manipulation of the other table (tbl_Inventory).

As Always, THANKS IN ADVANCE!!!
Chip
 
L

Lynn Trapp

You are very welcome. Best wishes with your project.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Chip said:
THANKS A MILLION!!!
Ths is the direction I was needing!!!

THANKS AGAIN!!!
Chip

Lynn Trapp said:
Chip,
You'll need to use the following command behind in the click event of
your
button:

Dim sqlInsertQueryStm As String

sqlInsertQueryStm = "Insert Into YourTable Values( " &
Me.txtFieldFromForm &
";"
DoCmd.RunSQL sqlInsertQueryStm

Obviously, the insert statement will be a lot more detailed than that,
but
this should get you started. Take a look at Help for Action Queries and
VBA
Help for the RunSQL command.



--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Chip said:
Howdy from Oklahoma!!!

I am relatively new to ACCESS and trying not to ask too many questions
here
but I have got one that I cant figure out. I apologize if this is
POSTED
twice on this Newsgroup as when I sent the first Questioon it just
disappeared and I did not receive a confrimation that it got sent.

I need a button on a form [frm_PO] to append (add) a new record in
another
table [tbl_Inventory] that is NOT the data source for the form. BUT
the
fields that I need to use to add the new record in [tbl_Inventory] are
on
the
form [frm_PO]. (i may need to add that I made sure that one of the
fields
being copied from the form is the "Primary Key" of [tbl_Inventory])
This
is
being done to receive in Materials from a Purchase Order (also in this
database) into my Inventory (tbl_Invnetory) and the 2 fields being
transferred will be (Part#) and (Quantity).

I also need another button to just add the quantity "received Quantity"
from
the frm_PO to an existing record of the Part# if the record is already
in
"tbl_Inventory". ( I have gotten the "logic" built to identify if the
record
is already there in the table for that Part# or if it is needed to be
added
because it is not there, I just cannot figure out how to do the actual
manipulation of the other table (tbl_Inventory).

As Always, THANKS IN ADVANCE!!!
Chip
 
K

Klatuu

The RunSql command is okay, especially for one record it wont make a lot of
difference; however, for future reference, if you are doing a bulk action
query, the
CurrentDb.Execute(SQL), dbFailOnError is much faster.

Lynn Trapp said:
You are very welcome. Best wishes with your project.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Chip said:
THANKS A MILLION!!!
Ths is the direction I was needing!!!

THANKS AGAIN!!!
Chip

Lynn Trapp said:
Chip,
You'll need to use the following command behind in the click event of
your
button:

Dim sqlInsertQueryStm As String

sqlInsertQueryStm = "Insert Into YourTable Values( " &
Me.txtFieldFromForm &
";"
DoCmd.RunSQL sqlInsertQueryStm

Obviously, the insert statement will be a lot more detailed than that,
but
this should get you started. Take a look at Help for Action Queries and
VBA
Help for the RunSQL command.



--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Howdy from Oklahoma!!!

I am relatively new to ACCESS and trying not to ask too many questions
here
but I have got one that I cant figure out. I apologize if this is
POSTED
twice on this Newsgroup as when I sent the first Questioon it just
disappeared and I did not receive a confrimation that it got sent.

I need a button on a form [frm_PO] to append (add) a new record in
another
table [tbl_Inventory] that is NOT the data source for the form. BUT
the
fields that I need to use to add the new record in [tbl_Inventory] are
on
the
form [frm_PO]. (i may need to add that I made sure that one of the
fields
being copied from the form is the "Primary Key" of [tbl_Inventory])
This
is
being done to receive in Materials from a Purchase Order (also in this
database) into my Inventory (tbl_Invnetory) and the 2 fields being
transferred will be (Part#) and (Quantity).

I also need another button to just add the quantity "received Quantity"
from
the frm_PO to an existing record of the Part# if the record is already
in
"tbl_Inventory". ( I have gotten the "logic" built to identify if the
record
is already there in the table for that Part# or if it is needed to be
added
because it is not there, I just cannot figure out how to do the actual
manipulation of the other table (tbl_Inventory).

As Always, THANKS IN ADVANCE!!!
Chip
 
L

Lynn Trapp

Excellent observation.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Klatuu said:
The RunSql command is okay, especially for one record it wont make a lot
of
difference; however, for future reference, if you are doing a bulk action
query, the
CurrentDb.Execute(SQL), dbFailOnError is much faster.

Lynn Trapp said:
You are very welcome. Best wishes with your project.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Chip said:
THANKS A MILLION!!!
Ths is the direction I was needing!!!

THANKS AGAIN!!!
Chip

:

Chip,
You'll need to use the following command behind in the click event of
your
button:

Dim sqlInsertQueryStm As String

sqlInsertQueryStm = "Insert Into YourTable Values( " &
Me.txtFieldFromForm &
";"
DoCmd.RunSQL sqlInsertQueryStm

Obviously, the insert statement will be a lot more detailed than that,
but
this should get you started. Take a look at Help for Action Queries
and
VBA
Help for the RunSQL command.



--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Howdy from Oklahoma!!!

I am relatively new to ACCESS and trying not to ask too many
questions
here
but I have got one that I cant figure out. I apologize if this is
POSTED
twice on this Newsgroup as when I sent the first Questioon it just
disappeared and I did not receive a confrimation that it got sent.

I need a button on a form [frm_PO] to append (add) a new record in
another
table [tbl_Inventory] that is NOT the data source for the form. BUT
the
fields that I need to use to add the new record in [tbl_Inventory]
are
on
the
form [frm_PO]. (i may need to add that I made sure that one of the
fields
being copied from the form is the "Primary Key" of [tbl_Inventory])
This
is
being done to receive in Materials from a Purchase Order (also in
this
database) into my Inventory (tbl_Invnetory) and the 2 fields being
transferred will be (Part#) and (Quantity).

I also need another button to just add the quantity "received
Quantity"
from
the frm_PO to an existing record of the Part# if the record is
already
in
"tbl_Inventory". ( I have gotten the "logic" built to identify if
the
record
is already there in the table for that Part# or if it is needed to
be
added
because it is not there, I just cannot figure out how to do the
actual
manipulation of the other table (tbl_Inventory).

As Always, THANKS IN ADVANCE!!!
Chip
 
K

Klatuu

Thanks.

Lynn Trapp said:
Excellent observation.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Klatuu said:
The RunSql command is okay, especially for one record it wont make a lot
of
difference; however, for future reference, if you are doing a bulk action
query, the
CurrentDb.Execute(SQL), dbFailOnError is much faster.

Lynn Trapp said:
You are very welcome. Best wishes with your project.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



THANKS A MILLION!!!
Ths is the direction I was needing!!!

THANKS AGAIN!!!
Chip

:

Chip,
You'll need to use the following command behind in the click event of
your
button:

Dim sqlInsertQueryStm As String

sqlInsertQueryStm = "Insert Into YourTable Values( " &
Me.txtFieldFromForm &
";"
DoCmd.RunSQL sqlInsertQueryStm

Obviously, the insert statement will be a lot more detailed than that,
but
this should get you started. Take a look at Help for Action Queries
and
VBA
Help for the RunSQL command.



--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



Howdy from Oklahoma!!!

I am relatively new to ACCESS and trying not to ask too many
questions
here
but I have got one that I cant figure out. I apologize if this is
POSTED
twice on this Newsgroup as when I sent the first Questioon it just
disappeared and I did not receive a confrimation that it got sent.

I need a button on a form [frm_PO] to append (add) a new record in
another
table [tbl_Inventory] that is NOT the data source for the form. BUT
the
fields that I need to use to add the new record in [tbl_Inventory]
are
on
the
form [frm_PO]. (i may need to add that I made sure that one of the
fields
being copied from the form is the "Primary Key" of [tbl_Inventory])
This
is
being done to receive in Materials from a Purchase Order (also in
this
database) into my Inventory (tbl_Invnetory) and the 2 fields being
transferred will be (Part#) and (Quantity).

I also need another button to just add the quantity "received
Quantity"
from
the frm_PO to an existing record of the Part# if the record is
already
in
"tbl_Inventory". ( I have gotten the "logic" built to identify if
the
record
is already there in the table for that Part# or if it is needed to
be
added
because it is not there, I just cannot figure out how to do the
actual
manipulation of the other table (tbl_Inventory).

As Always, THANKS IN ADVANCE!!!
Chip
 

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