Get data from a table, Update another Table, all from a Form

I

Irshad Alam

Its a repost, as this is related to same topic but little different situation.
I want to update a Table "InvTabB", the data to be collect from Table
"DoTabB". All I wanted to be done from the Form "InvFrormA" on Label Click
event . I tried to make a Append Query and run from form, but it gives the
problem, which I have mentioned below. Therefore, I thought if any can guide
to me covert the below code into VB code, then may be my job can be done.
I mean the same job but through VB, so that I can use on a form label click
event.

INSERT INTO InvTabB ( InvNum, SqNo, PartNo, [Desc], Qty, UPrice, ExtPrice )
SELECT InvTabB.InvNum, DoTabB.SqNo, DoTabB.PartNo, DoTabB.Desc, DoTabB.Qty,
DoTabB.UPrice, DoTabB.ExtPrice
FROM (DoTabB INNER JOIN InvTabA ON DoTabB.DONum = InvTabA.DONum) INNER JOIN
InvTabB ON InvTabA.InvNum = InvTabB.InvNum
WHERE (((InvTabB.InvNum)=[Forms]![InvFormA]![InvNum]) AND
((DoTabB.DONum)=[Forms]![InvFormA]![DONum]));

The same I tried to do with Query, It does the work perfect, but the
following problem arises:
1. Its needs at least one record to be posted in Invoice Subform
"InvFormB", If I dont post any record on suform, it does not post any
records. If I post at least one record, then it paste the data perfectly. I
wanted my job to be done , when I will click, it should post the data
according to my subform related Table and requery my subform Control.

2. It makes appear the the confirmation dailog.

Due to these reason I was trying to do the same by the help of VBA.
Please advise me, it should be based on the above SQL, I mean the above code
is in SQL, the same I want on a click event of a form Label.

Regards.
 

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