D
Damir Dezeljin
Hi.
This is going to be a long post - I hope someone will take time to read
it ... even better would be if I will get any reply
I designed a simple Access database with some forms for entering data.
Heh ... this was a big achievement for me as I'm completely new to
Access, VB and so on. Another problem is my strong background from C and
similar programming languages - I spent quite some time to figure out
that ' is used for comments in VB
Another thing I’m still looking for is how to use bitwise AND and
bitwise OR functions (e.g. 1 | 4 should be 5; 5 & 2 should be 0).
First the description of what I would like to do:
I was using a simple Excel spreadsheet for my personal accounting
(incomes / outgoings). Last month I spent lot of time to get needed data
in a readable form out of the spreadsheet. So I decided I will do a
simple Access program for my accounting (this way I will learn something
new).
I defined below databases:
----
purchase: // contains purchase records
pID Integer AutoIncrement
priece Number // price
cID Number // currency ID
tID Number // type ID
date Date // date of purchase
desc Text // purchase description
currency: // contains currencies
cID Integer AutoIncrement
curr Text // currency abbreviation (e.g. USD)
type: // contains types (e.g. sport, food)
tID Integer AutoIncrement
type Text // e.g. sport, food, fun,…
c_rate: // change rate X <local_currency> = 1 <currency>
rID Integer AutoIncrement
cID Integer
lVal Integer // how much local currency is one unit of foreign one
date Date // date of the change rate
----
Of course I defined all relations too.
After creating the input tabular forms, I entered all the data.
Now I’m trying to define a simple report. I already grouped purchases
first by month with currency sub grouping. This works fine. Now I would
like to have an field containing the amount of local currency spend for
each month. So this means that the report should calculate a local
amount for each currency group sum and multiply it with the change rate.
My form is based on first three tables (it is retrieving price, date,
curr and type – the last one is not used for now). So I’m wondering what
the best way of achieving desired results is.
I got an idea to define a global variable in a module. Whenever a new
month group is started a global variable should be initialized to e.g.
0. Afterwards every time a certain currency group is processed, the
sum() amount should be multiplied with the change rate and the resulting
number should be added to the global variable. The question is how I
should retrieve the change rate for the current month (let say that
there will be only one change rate per month / currency in c_rate table.
I guess a solution would be to use ADO and do a query every time. Is
there any other way to do it?
Is there a way to avoid using a global variable?
Oracle PL-SQL allows defining variables – is it possible to use query
variables in Access too (BTW: is it possible to use T-SQL with Access DB?)?
Is there any high level data type like Dictionary or associative arrays
available in Access VB (I tried to use
CreateObject(Scripting.Dictionary) << or something similar , however I
got an error)?
The below text is here to avoid an additional posting
I guess it is possible to use some sort of filters in Access forms. Is
it possible to use it in a ‘standard’ form (e.g. in my tabular form for
entering data)? If yes – how?
Thanks and best regards,
Dezo
This is going to be a long post - I hope someone will take time to read
it ... even better would be if I will get any reply
I designed a simple Access database with some forms for entering data.
Heh ... this was a big achievement for me as I'm completely new to
Access, VB and so on. Another problem is my strong background from C and
similar programming languages - I spent quite some time to figure out
that ' is used for comments in VB
Another thing I’m still looking for is how to use bitwise AND and
bitwise OR functions (e.g. 1 | 4 should be 5; 5 & 2 should be 0).
First the description of what I would like to do:
I was using a simple Excel spreadsheet for my personal accounting
(incomes / outgoings). Last month I spent lot of time to get needed data
in a readable form out of the spreadsheet. So I decided I will do a
simple Access program for my accounting (this way I will learn something
new).
I defined below databases:
----
purchase: // contains purchase records
pID Integer AutoIncrement
priece Number // price
cID Number // currency ID
tID Number // type ID
date Date // date of purchase
desc Text // purchase description
currency: // contains currencies
cID Integer AutoIncrement
curr Text // currency abbreviation (e.g. USD)
type: // contains types (e.g. sport, food)
tID Integer AutoIncrement
type Text // e.g. sport, food, fun,…
c_rate: // change rate X <local_currency> = 1 <currency>
rID Integer AutoIncrement
cID Integer
lVal Integer // how much local currency is one unit of foreign one
date Date // date of the change rate
----
Of course I defined all relations too.
After creating the input tabular forms, I entered all the data.
Now I’m trying to define a simple report. I already grouped purchases
first by month with currency sub grouping. This works fine. Now I would
like to have an field containing the amount of local currency spend for
each month. So this means that the report should calculate a local
amount for each currency group sum and multiply it with the change rate.
My form is based on first three tables (it is retrieving price, date,
curr and type – the last one is not used for now). So I’m wondering what
the best way of achieving desired results is.
I got an idea to define a global variable in a module. Whenever a new
month group is started a global variable should be initialized to e.g.
0. Afterwards every time a certain currency group is processed, the
sum() amount should be multiplied with the change rate and the resulting
number should be added to the global variable. The question is how I
should retrieve the change rate for the current month (let say that
there will be only one change rate per month / currency in c_rate table.
I guess a solution would be to use ADO and do a query every time. Is
there any other way to do it?
Is there a way to avoid using a global variable?
Oracle PL-SQL allows defining variables – is it possible to use query
variables in Access too (BTW: is it possible to use T-SQL with Access DB?)?
Is there any high level data type like Dictionary or associative arrays
available in Access VB (I tried to use
CreateObject(Scripting.Dictionary) << or something similar , however I
got an error)?
The below text is here to avoid an additional posting
I guess it is possible to use some sort of filters in Access forms. Is
it possible to use it in a ‘standard’ form (e.g. in my tabular form for
entering data)? If yes – how?
Thanks and best regards,
Dezo