Help in writing a simple function

  • Thread starter Thread starter ravi_bellamkond
  • Start date Start date
R

ravi_bellamkond

Guest
Hi,
Iam new to VBA, can anyone plz help me in acomplishing this task,

Dim db As Database
Dim rst As DAO.Recordset

Call CalcShare(rst.Fields(0))
Update the rst.Fields(1) with the result returned by the function

The function should look like,

Function CalcShare(arg1 As Integer) As Double
.....
....
.....
Should return the result as (arg1 * 10)
END Function


Thanks in advance..

Ravi.
 
Code:
Dim db As DAO.Database
Dim rst As DAO.Recordset

Do while not rst.eof
rst.Fields(1).Value = CalcShare(rst.Fields(0))
rst.movenext
Loop

Code:
Public Function CalcShare(arg1 As Integer) As Double
CalcShare = arg1 * 10
'Should return the result as (arg1 * 10)
END Function

Good Job - that was very close...
 

Users who are viewing this thread

Back
Top Bottom