473,396 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Writing form calculated values to fields in a table

MX1
Oh boy, this is kind of a big one. I have a form with several calculated
fields on spanning 5 rows. I somehow need to get the field values into a
table. Challenge is I don't know how to do this. What makes it tougher is
the rows need to be written to the table only if the total does not equal
zero - kind of a supression thing. Here's a quick mock up:

Form might contain these values (simplied for ease of reading)

Row1Val1=500
Row1Val2=300
Row1Percent=10 (added val1 and val2 then multiplied by percent)
Row1Total=80

Row2Val1=100
Row2Val2=400
Row2Percent=5
Row2Total=25

Row3Val1=0
Row3Val2=0
Row3Percent=1
Row3Total=0

So, now that we have values from the form, I need to right out only two
distinct rows in the destination table (because row3=0). I'm thinking this
may be done with an update query but not sure of the logic. If anyone has
any thoughts on this, I'd really appreciate it.

Table is waiting for data and would like this when done:

Val1, Val2, Percent
500 300 10
100 400 5

Again, row3 not written to table because it had a total of zero.

Many Thanks!
Nov 13 '05 #1
5 1757
MX1
OK, I've figured out that I need a Append Query. Have it written but not
sure how to initiate it from the VBA code. Any thoughts?

"MX1" <mx*@mx1.abc> wrote in message news:MPdNc.32846$8_6.12960@attbi_s04...
Oh boy, this is kind of a big one. I have a form with several calculated
fields on spanning 5 rows. I somehow need to get the field values into a
table. Challenge is I don't know how to do this. What makes it tougher is the rows need to be written to the table only if the total does not equal
zero - kind of a supression thing. Here's a quick mock up:

Form might contain these values (simplied for ease of reading)

Row1Val1=500
Row1Val2=300
Row1Percent=10 (added val1 and val2 then multiplied by percent)
Row1Total=80

Row2Val1=100
Row2Val2=400
Row2Percent=5
Row2Total=25

Row3Val1=0
Row3Val2=0
Row3Percent=1
Row3Total=0

So, now that we have values from the form, I need to right out only two
distinct rows in the destination table (because row3=0). I'm thinking this may be done with an update query but not sure of the logic. If anyone has
any thoughts on this, I'd really appreciate it.

Table is waiting for data and would like this when done:

Val1, Val2, Percent
500 300 10
100 400 5

Again, row3 not written to table because it had a total of zero.

Many Thanks!

Nov 13 '05 #2
MX1
OK, for those of you who may be following along, I found the RunSQL Method
and have it launching a query OK. I think I'm all set now. I hope this can
help someone out there.

:)

"MX1" <mx*@mx1.abc> wrote in message
news:LpfNc.162867$a24.154204@attbi_s03...
OK, I've figured out that I need a Append Query. Have it written but not
sure how to initiate it from the VBA code. Any thoughts?

"MX1" <mx*@mx1.abc> wrote in message

news:MPdNc.32846$8_6.12960@attbi_s04...
Oh boy, this is kind of a big one. I have a form with several calculated fields on spanning 5 rows. I somehow need to get the field values into a table. Challenge is I don't know how to do this. What makes it tougher

is
the rows need to be written to the table only if the total does not equal zero - kind of a supression thing. Here's a quick mock up:

Form might contain these values (simplied for ease of reading)

Row1Val1=500
Row1Val2=300
Row1Percent=10 (added val1 and val2 then multiplied by percent)
Row1Total=80

Row2Val1=100
Row2Val2=400
Row2Percent=5
Row2Total=25

Row3Val1=0
Row3Val2=0
Row3Percent=1
Row3Total=0

So, now that we have values from the form, I need to right out only two
distinct rows in the destination table (because row3=0). I'm thinking

this
may be done with an update query but not sure of the logic. If anyone has any thoughts on this, I'd really appreciate it.

Table is waiting for data and would like this when done:

Val1, Val2, Percent
500 300 10
100 400 5

Again, row3 not written to table because it had a total of zero.

Many Thanks!


Nov 13 '05 #3
Put the following code in the Click event of a button or where appropriate:

Docmd.SetWarnings False
DoCmd.OpenQuery "NameOfAppendQuery"
Docmd.SetWarnings True
MsgBox "Data where total does not equal 0 has been appended to table"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"MX1" <mx*@mx1.abc> wrote in message news:LpfNc.162867$a24.154204@attbi_s03...
OK, I've figured out that I need a Append Query. Have it written but not
sure how to initiate it from the VBA code. Any thoughts?

"MX1" <mx*@mx1.abc> wrote in message news:MPdNc.32846$8_6.12960@attbi_s04...
Oh boy, this is kind of a big one. I have a form with several calculated
fields on spanning 5 rows. I somehow need to get the field values into a
table. Challenge is I don't know how to do this. What makes it tougher

is
the rows need to be written to the table only if the total does not equal
zero - kind of a supression thing. Here's a quick mock up:

Form might contain these values (simplied for ease of reading)

Row1Val1=500
Row1Val2=300
Row1Percent=10 (added val1 and val2 then multiplied by percent)
Row1Total=80

Row2Val1=100
Row2Val2=400
Row2Percent=5
Row2Total=25

Row3Val1=0
Row3Val2=0
Row3Percent=1
Row3Total=0

So, now that we have values from the form, I need to right out only two
distinct rows in the destination table (because row3=0). I'm thinking

this
may be done with an update query but not sure of the logic. If anyone has
any thoughts on this, I'd really appreciate it.

Table is waiting for data and would like this when done:

Val1, Val2, Percent
500 300 10
100 400 5

Again, row3 not written to table because it had a total of zero.

Many Thanks!


Nov 13 '05 #4
MX1
Cool, I actually found the setwarnings thing after I finally go annoyed
hitting OK. Thanks for your help!

One odd thing about my form is that when I click the New Record button, it
does not seem to zero out the calc'd fields. Very odd. Any thoughts on how
to handle this?

PS. I actually put the SQL code in the VBA query itself.

"PC Datasheet" <no****@nospam.spam> wrote in message
news:%z*****************@newsread3.news.atl.earthl ink.net...
Put the following code in the Click event of a button or where appropriate:
Docmd.SetWarnings False
DoCmd.OpenQuery "NameOfAppendQuery"
Docmd.SetWarnings True
MsgBox "Data where total does not equal 0 has been appended to table"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"MX1" <mx*@mx1.abc> wrote in message

news:LpfNc.162867$a24.154204@attbi_s03...
OK, I've figured out that I need a Append Query. Have it written but not
sure how to initiate it from the VBA code. Any thoughts?

"MX1" <mx*@mx1.abc> wrote in message news:MPdNc.32846$8_6.12960@attbi_s04...
Oh boy, this is kind of a big one. I have a form with several calculated fields on spanning 5 rows. I somehow need to get the field values into a table. Challenge is I don't know how to do this. What makes it tougher is
the rows need to be written to the table only if the total does not

equal zero - kind of a supression thing. Here's a quick mock up:

Form might contain these values (simplied for ease of reading)

Row1Val1=500
Row1Val2=300
Row1Percent=10 (added val1 and val2 then multiplied by percent)
Row1Total=80

Row2Val1=100
Row2Val2=400
Row2Percent=5
Row2Total=25

Row3Val1=0
Row3Val2=0
Row3Percent=1
Row3Total=0

So, now that we have values from the form, I need to right out only two distinct rows in the destination table (because row3=0). I'm thinking

this
may be done with an update query but not sure of the logic. If anyone has any thoughts on this, I'd really appreciate it.

Table is waiting for data and would like this when done:

Val1, Val2, Percent
500 300 10
100 400 5

Again, row3 not written to table because it had a total of zero.

Many Thanks!



Nov 13 '05 #5
MX1
Forget it, figured I can zero out variables on CurrentRecord Event
Procedure. Thanks anyway.

:)

"MX1" <mx*@mx1.abc> wrote in message news:4AhNc.34054$8_6.30431@attbi_s04...
Cool, I actually found the setwarnings thing after I finally go annoyed
hitting OK. Thanks for your help!

One odd thing about my form is that when I click the New Record button, it
does not seem to zero out the calc'd fields. Very odd. Any thoughts on how to handle this?

PS. I actually put the SQL code in the VBA query itself.

"PC Datasheet" <no****@nospam.spam> wrote in message
news:%z*****************@newsread3.news.atl.earthl ink.net...
Put the following code in the Click event of a button or where appropriate:

Docmd.SetWarnings False
DoCmd.OpenQuery "NameOfAppendQuery"
Docmd.SetWarnings True
MsgBox "Data where total does not equal 0 has been appended to table"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"MX1" <mx*@mx1.abc> wrote in message

news:LpfNc.162867$a24.154204@attbi_s03...
OK, I've figured out that I need a Append Query. Have it written but not sure how to initiate it from the VBA code. Any thoughts?

"MX1" <mx*@mx1.abc> wrote in message news:MPdNc.32846$8_6.12960@attbi_s04... > Oh boy, this is kind of a big one. I have a form with several calculated > fields on spanning 5 rows. I somehow need to get the field values into a > table. Challenge is I don't know how to do this. What makes it tougher is
> the rows need to be written to the table only if the total does not equal > zero - kind of a supression thing. Here's a quick mock up:
>
> Form might contain these values (simplied for ease of reading)
>
> Row1Val1=500
> Row1Val2=300
> Row1Percent=10 (added val1 and val2 then multiplied by percent)
> Row1Total=80
>
> Row2Val1=100
> Row2Val2=400
> Row2Percent=5
> Row2Total=25
>
> Row3Val1=0
> Row3Val2=0
> Row3Percent=1
> Row3Total=0
>
> So, now that we have values from the form, I need to right out only two > distinct rows in the destination table (because row3=0). I'm thinking this
> may be done with an update query but not sure of the logic. If
anyone has > any thoughts on this, I'd really appreciate it.
>
> Table is waiting for data and would like this when done:
>
> Val1, Val2, Percent
> 500 300 10
> 100 400 5
>
> Again, row3 not written to table because it had a total of zero.
>
> Many Thanks!
>
>



Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jack | last post by:
Hi, I got a asp form page where the POST ACTION = confirmation.asp page is used to save the values collected from text boxes from the form in a database. For example txtTotalOutlay field is being...
3
by: Steve | last post by:
Form FrmRestock's recordsource is QryFrmRestock. The TransactionDate field's criteria is set ats: Forms!FrmRestock!LastXDays. LastXDays on the form is a combobox where the selections are 30, 60...
2
by: B Love | last post by:
Hello Group, I have 2 text fields that I would like to concatenate for use in a table. One field is an ordinary text box. The other is a simple combo box which I use to select one of about ten...
9
by: Tony Williams | last post by:
I have two tables 1.tblmonth which holds two fields txtmonth and txtqtrlabel and 2. tblmain which holds a number of fields but in particular a field called txtqtrlabel2. The two tables are linked...
2
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
3
by: S P Arif Sahari Wibowo | last post by:
Hi! I would like to make an editable continous form, where most fields will be from table A and editable, except 1-3 fields are a glimpse into table B and uneditable. Table A relate to table B...
8
by: TORQUE | last post by:
Hi, I am having some trouble with recording a field on a form into my Table after formatting it to calculate several fields on the form. If i just put the amount in the field and have it linked...
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
1
by: sshafer1 | last post by:
I have a form that is using query as the backend 'table'. I did this so that I could display query fields in my form that have been calculated. 1. How do I write those query field values to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.