?
Solved

How create record in unbound table

Posted on 2011-10-19
2
Medium Priority
?
315 Views
Last Modified: 2013-11-05
I have a form that has these fields:

cboPartN (text field)
txtJobN (text field)
txtQty (number field)
txtType (text field)
txtDateEntered (date field)
cboToWH (text field)

When a record has been written to the bound table (records source) of the form I want a new record to be written to an unbound table.  The name of this unbound table is “tblFGTranx”.  The mapping of the information should be:
cboPartN (text field) > tblFGTranx.PartN
txtJobN (text field) > tblFGTranx.JobN
txtQty (number field) > tblFGTranx.Qty
txtType (text field) > tblFGTranx.Type
txtDateEntered (date field) > tblFGTranx.DateEntered
cboToWH (text field) > tblFGTranx.toWH

There is one catch however.  When the Qty field is written I need it to be a negative entry.

What would the code for handling this be and where do you suggest it be handled at?  Maybe on a save record command button event of the form?

--Steve
0
Comment
Question by:SteveL13
2 Comments
 
LVL 9

Accepted Solution

by:
sshah254 earned 1000 total points
ID: 36993952
insert into tblFGTranx values (cboPartN, txtJobN, -1 (for txtQty), txtType, txtDate, cboToWHH);

Yes, on the "save record" command button's event.

SS
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1000 total points
ID: 36993970
you have to run an insert query or use recordsets,  

which would you prefer?

this will add new record to the table  "tblFGTranx"

with currentdb.openrecordset("tblFGTranx")
      .addnew
      !PartN=me.cboPartN
      !JobN=me.txtJobN
      !Qty= me.txtQty * -1
      ![Type]=me.txtType
      !DateEntered=me.txtDateEntered
      !toWH=me.cbotoWH
      .Update
end with

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question