Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Unable to call public function in a form

$
0
0
I have got two forms in my program:
1.frm_itemlist
2.frm_supplier
I have declared a public function named Clear in frm_itemlist.This function works fine when I call it in frm_itemlist.The problem occurs when I try to call the function in frm_supplier. The function simply doesnt execute and neither do i get any errors. Here is the code for the function :
Public Sub Clear() 'will empty the all fields on the current form
    Dim a As Control    'variable declared for controls'
    For Each a In Controls  'found each control in the entire form'
        If TypeOf a Is TextBox Then 'if control is text then the value of the text will be set empty'
        a.Text = ""
        End If
    Next
End Sub


Here is the code I am using to call it in frm_supplier:
Private Sub cmd_ClearSupplier_Click()
Call frm_itemlist.Clear
End Sub


Please help me out. Thanks in advance.....

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>