473,395 Members | 1,437 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,395 software developers and data experts.

Specifying values in fields in a table!

Hi,

It's a simple thing I'm trying to do and I have looked and looked
without success.

I have a table named tblMain with columns Order_ID, Price, Tax

What I want to do is: in the Form frmMain, when a user inputs a Price,
the Tax field is calculated as a percentage of the Price value and then
save it back to the table.

I want to learn to do this in VBA or SQL and so far all I have learned
to how to open a database

Dim dbsMain As Database
Dim rsNum As Recordset

Set dbsMain = OpenDatabase("C:\TEMP.mdb")
Set rsNum = _
dbsMain.OpenRecordset("tblMain")

I hope I at least got this right. It's opening a file called TEMP.mdb
located in C:\ and reading the tblMain into rsNum.

Please correct me if I am already wrong.

Can someone show me how to begin accessing the values in the rsNum?
For example, if I wanted to do a calculation to change the column Tax
in tblMain? How do I access a row? a column? or just one field at row
X, column Y?

Please help!
Thanks in advance

Nov 13 '05 #1
2 1270
calculate the tax in the BeforeInsert event of the form. You could put
the "tax due" field on the form, but not show it or something. then
just set the value there.

frm_BeforeInsert()
Me.TaxDue = CalcTax(curAmtPaid)

How you access a single row depends on how your form is set up. Do you
have a main form/subform or just one form without a subform? is it
continuous?

Nov 13 '05 #2
That's another thing that I'm having trouble getting/understanding.

I'm assuming that Me.TaxDue specifies the Me (the current table?)
TaxDue is a column?

Is there a place for me to get all these syntaxes???

My form is a simple single form. (I dont' know what continuous is, but
I don't think it is continuous - more reading for later =)

Nov 13 '05 #3

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

Similar topics

8
by: Dave Moore | last post by:
Is there any way to specify an istream separator sequence? For example, suppose I have a record consisting of a list of comma-separated values (no whitespace). I want to set the istream up so that...
3
by: JOEP | last post by:
What do I need to do to allow an append query to post null values to records in a field of the destination table? Basically I want to allow records with null values to post to the table. The append...
3
by: kathyburke40 | last post by:
Odd problem. I have a table in the following format: DocID Question1 Question2 Question3 ------------------------------------------------ 298 1, 2, 3 or 0 Each Question...
2
by: Viorel | last post by:
Adding new row with default values. In order to insert programmatically a new row into a database table, without direct "INSERT INTO" SQL statement, I use the well-known DataTable.NewRow,...
10
by: Steve Atkins | last post by:
I have a large table (potentially tens or hundreds of millions of rows) and I need to extract some number of these rows, defined by an integer primary key. So, the obvious answer is select *...
3
by: mkjets | last post by:
I have worked for hours on trying to find a solution and have not figured it out. I am working in Access 2003. I need to create a query that takes values from 1 table and displays them in...
1
by: P3Eddie | last post by:
Hello All! Sorry if this is basic, but I'm having trouble finding a way to specify unique fields (like you would ADD CONSTRAINT in an ALTER TABLE statement) for a new table I'm creating with a...
5
by: mfaisalwarraich | last post by:
Hi, I have a table called mainTable. two fields of this table are SNO which is text and Relation which is also text. there are more than 10 fields in this table. i made a small form called...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.