Programming Form in MS Access 2000

L

Latina_Dapro

Hi!

I need to program a form in MS Access 2000, so as I see, I need to know
Visual Basic to do it.

I am very new in programming, that's way I ask you:

1.- How can I change a "Date fiel" to "number field"?

2.- How can I declare a Array?

3.- Becouse I need to subtract two "Date fiels" I think I need a type
transformation otherwise it dosnt work.

Many greetings,

Latina_Dapro
 
S

Stefan Hoffmann

hi,

Latina_Dapro said:
1.- How can I change a "Date fiel" to "number field"?
Change the field type in the design view of your table.
2.- How can I declare a Array?
Dynamic array

Dim a() As <YourType> using ReDim a(fromIndex To toIndex)

or static array

Dim a(fromIndex To toIndex) As said:
3.- Becouse I need to subtract two "Date fiels" I think I need a type
transformation otherwise it dosnt work.
No. Dates are stored as Double values, so Date1 - Date2 works. See also
OH for DateDiff()

And: Buy an Access book.


mfG
--> stefan <--
 
K

Klatuu

Date1 - Date2 only works if you are subtracting days. It is better practice
to always use the DateDiff function.
 
S

Stefan Hoffmann

hi,
Date1 - Date2 only works if you are subtracting days.
It works for subtracting dates, it don't work for subtracting periods.
It is better practice to always use the DateDiff function.
In most cases, yes. Using it in queries can speed up the execution
dramatically, but this depends on the actual problem.


mfG
--> stefan <--
 
L

Latina_Dapro

Hi Stefan, thank you for your answers,

Now it is working as you tolk me, but I have 1000 register and it show me
only one.

Private Sub Month_Click()
Dim c1 As Variant
Dim result1 As Variant

Select Case Month

Case "January"

c1 = date1 – date2 (date1,date2 are not declared in my
modul, but the program know who are they, they are declared in the form )

if (c1 = 0) (case1 :if the result=0, the products are
sending at the date they were ordered )

instructions to execute:

c1 = result1 (save the result in a variable to
add all results=0 ) example:
date 1 date2
20060801 - 20060801 = 0
20060801 - 20060801 = 0
20060801 - 20060801 = 0
20060801 - 20060801 = 0
total: 4

result1= result1 + 1 (a counter for the total results)

Questions:


1.- the small prodecure it is working but it show only the first register, I
have 1000, how can I see the result of the total subtraction? So like up in
my example?

2.- How is the transmission-prosess in VisualBasic?
I programmed the code on Month_Click_Event, I thought so I can show the
result on the form but it is not so.

Form_Formular_Prueba.total_result1.Text (c2)


Many Greetings,

Latina_Dapro
 
Top