PDA

Click to See Complete Forum and Search --> : Database's


Squid13_2000
Sep 25th, 2000, 10:27 AM
Does anyone know how to calculate the value of cells in a database field. I'm new to vb and i'm trying to multiply one cell times another cell in my program and i cant figure it out. Also i was wondering if you don't have acess can you use another database to link to your vb project. And if so how? Thanks


Here's some source code of what I've been trying to do


Example1

Private Sub DataGrid1_Click()
Set rsta = Adodc1.Recordset
rsta.Fields(0).Value X rsta.Fields(1).Value = rsta.Fields(2).Value

End Sub

Example2
Private Sub DataGrid1_Click()
Set rsta = Adodc1.Recordset
rsta![field name2] * [field name2] = [field name3]

End Sub





[Edited by Squid13_2000 on 09-25-2000 at 02:50 PM]

Patrice Bourdages
Sep 25th, 2000, 11:45 AM
Show us some code sample. Source code helps a lot when trying to figure out problems. ;)

Sep 26th, 2000, 05:50 AM
IF you want the result in field3 then try
something like this: :

[field name3] = [field name2] * [field name2]

Patrice Bourdages
Sep 26th, 2000, 11:57 AM
Silly Billy me...! ;)

I was propably asleep when reading your post...

Try:

rsta!ResultField = rsta!FirstField * rsta!SecondField


:) It should work :)