MS access Function Array Event

mothi

Registered User.
Local time
Yesterday, 20:56
Joined
Dec 26, 2009
Messages
111
Trying to achieve, capturing the deleted record information and storing it in a array in the ONDelete event and using that same array in the AfterDeleteConfirm event , writing the values to the table.

iam calling the function in the AFTERDELEVEnt := modprocess([Form])


In my form's module at module level , I declared below two variables

declared DIm var_part(10) as string
DIm var_sub as variant


I am using the array to store the deleted record information , as you can see

In the ONDElete event

var_sub =1

var_part(var_sub) = Me.frm_cin & "," & Me.frm_type



the below code is in a function ( general module) ( in here i need to use the array( Declared at form ‘s module level variable(var_part)) and I definitely know that I did wrong regarding this , I need to help me out regarding this

Public Function modprocess(frm As Form) As Integer

var_sub = 0

On Error GoTo modprocess_Error


Do Until modprocess = 0 And var_sub >= frm.SelHeight

Dim strsql As String

var_sub = var_sub + 1

strsql = "Insert into tbl_delete(part_table,part_delete) values('" & frm.RecordSource & "' , '" & var_part(var_sub) & "')"

DoCmd.RunSQL strsql

Loop

modprocess_Exit:

Exit Function

modprocess_Error:

MsgBox "nothing"
modprocess = True
Resume modprocess_Exit



End Function
 
you don't need an array for this. capture the values with variables in code, then write them to the table.
 

Users who are viewing this thread

Back
Top Bottom