replyrpatil
Programmer
I have 35 fields and 35 images associated to these fields ( Example filed name is f1 then the Image/Picture filed associated to it is named as IMGAUGE )
Let us say if other filed names are f2 , f3 ………..f35
I don’t want to copy paste the same code 35 times ( i.e. for f2 I will select the code and replace f1 with f2)
IS THERE A WAY TO WRITE A SINGEL MODULE and call it as I need.
For example I want to create a single function in module say name “ImgCheck”
Then in call it like this….
Private Sub f1_AfterUpdate()
Call ImgCheck (f1)
End Sub
Private Sub f2_AfterUpdate()
Call ImgCheck (f2)
End Sub
And so on…………………
I tried to write a module but gives me error “ Compile Error : ByRef argument type mismatch)
Following is my code that I need to convert to module/function that I can call
*******************************************************************
Private Sub f1_AfterUpdate()
Dim strgtif As String
Dim tifverfy As String
Dim ImagePath As String
ImagePath = "C:\ BAS\"
If Nz(Me.f1, "") <> "" Then
strgtif = Me.f1
tifverfy = Right([strgtif], 4)
If tifverfy = ".TIF" Then
Forms!FrmProductInformation![IMf1].Picture = ImagePath & Me.f1
Else
Forms!FrmProductInformation![IMf1].Picture = "(none)"
End If
Else
Forms!FrmProductInformation![IMf1].Picture = "(none)"
End If
End Sub
*****************
Let us say if other filed names are f2 , f3 ………..f35
I don’t want to copy paste the same code 35 times ( i.e. for f2 I will select the code and replace f1 with f2)
IS THERE A WAY TO WRITE A SINGEL MODULE and call it as I need.
For example I want to create a single function in module say name “ImgCheck”
Then in call it like this….
Private Sub f1_AfterUpdate()
Call ImgCheck (f1)
End Sub
Private Sub f2_AfterUpdate()
Call ImgCheck (f2)
End Sub
And so on…………………
I tried to write a module but gives me error “ Compile Error : ByRef argument type mismatch)
Following is my code that I need to convert to module/function that I can call
*******************************************************************
Private Sub f1_AfterUpdate()
Dim strgtif As String
Dim tifverfy As String
Dim ImagePath As String
ImagePath = "C:\ BAS\"
If Nz(Me.f1, "") <> "" Then
strgtif = Me.f1
tifverfy = Right([strgtif], 4)
If tifverfy = ".TIF" Then
Forms!FrmProductInformation![IMf1].Picture = ImagePath & Me.f1
Else
Forms!FrmProductInformation![IMf1].Picture = "(none)"
End If
Else
Forms!FrmProductInformation![IMf1].Picture = "(none)"
End If
End Sub
*****************