DELETE record

K

kealaz

Hello,

I have two tables and here is what they look like.

tblPOTODO
PARTNO
MANUF1
MANUF1PN
MANUF2
MANUF2PN
MANUF3
MANUF3PN

tblBUY
PARTNO
MANUF
VENDORNAME

My form [frmPOTODO_process] brings in the information from tblPOTODO. The
user can choose which manuf of the part to purchase. Once that selection is
made, then a combo box is populated with the vendors that sell that manuf
part, and the user can choose which vendor to purchase the part from. Then,
the information... PARTNO, ONE of the MANUF and the VENDOR... is written to
tblBUY. My purchase order subform gets it's information from tblBUY.

Most... or a lot of the above is working right now. My questions is... how
do I get my form to delete the record from tblPOTODO once I have selected the
manuf and vendor and passed that information to tblBUY?

Please be specific and I am REALLY a novice.

Thank you so much for your time and consideration with this!!!
 
K

kealaz

Hi Richard,
Thank you so much for responding!!!

The form that I am using frmPOTODO_process has as it's record source
tblBUY, so that when I click on the "save and close" command button at the
end, it writes the information from the form to tblBUY.
I bring the content in from tblPOTODO by using the following on a combo
box.
Row Source Type: Table/Query
Row Source: SELECT tblPOTODO.PART_NO, tblPOTODO.NAME, tblPOTODO.MANUF1,
tblPOTODO.MANUF1_PN, tblPOTODO.MANUF2, tblPOTODO.MANUF2_PN, tblPOTODO.MANUF3,
tblPOTODO.MANUF3_PN FROM tblPOTODO;
Then I use code on two other combo boxes to populate them with the
choices of MANUF to make that selection and then more code on yet another
combo box to allow the user to make a vendor selection. Once all of those
selections are made, there is a command button that runs a macro that is
simply to save [to tblBUY] and close the form.
What I need is to delete the record of that part, from tblPOTODO. Thank
you so much for that line of code. Can you please further help me, by
telling me where I should place this. I would like it to run when I click on
the "save and close" command button.

Thank you,
Kealaz
 
K

kealaz

Hi Richard,
Thank you so much for your reply! I really appreciate the help.

~Angel



Kardan via AccessMonster.com said:
Hi Kealaz

Sorry for the delay in replying, I have been busy at this end.

I was a little surprised that the record source for your form was tblBUY, but
we can work with that.

The code you will need behind your command button is;

strSQL = "DELETE * FROM tblPOTODO WHERE [PART_NO] = "
strSQL = strSQL & Chr(34) & Me.Combo1 & Chr(34)

DoCmd.RunSQL strSQL

The assumptions made with this code are;

[PART_NO] is the key to your table tblPOTODO
Combo1 is the name of your main combo box (please replace with the correct
name)
[PART_NO] is the bound column for Combo1

Regards

Richard


Hi Richard,
Thank you so much for responding!!!

The form that I am using frmPOTODO_process has as it's record source
tblBUY, so that when I click on the "save and close" command button at the
end, it writes the information from the form to tblBUY.
I bring the content in from tblPOTODO by using the following on a combo
box.
Row Source Type: Table/Query
Row Source: SELECT tblPOTODO.PART_NO, tblPOTODO.NAME, tblPOTODO.MANUF1,
tblPOTODO.MANUF1_PN, tblPOTODO.MANUF2, tblPOTODO.MANUF2_PN, tblPOTODO.MANUF3,
tblPOTODO.MANUF3_PN FROM tblPOTODO;
Then I use code on two other combo boxes to populate them with the
choices of MANUF to make that selection and then more code on yet another
combo box to allow the user to make a vendor selection. Once all of those
selections are made, there is a command button that runs a macro that is
simply to save [to tblBUY] and close the form.
What I need is to delete the record of that part, from tblPOTODO. Thank
you so much for that line of code. Can you please further help me, by
telling me where I should place this. I would like it to run when I click on
the "save and close" command button.

Thank you,
Kealaz
[quoted text clipped - 14 lines]

--
Regards,

Richard
www.kardanconsulting.co.uk

Message posted via AccessMonster.com
 

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