Hi Guys,
I'm writing some VBA subroutines in an access database...
I want to have a routine which disables a box, etc ... but when I call the routine I would like to specifiy the name of the box in the call, is this possible? I've tried myself but get errors but I don't know the correct syntax though - google is a bit dry on this but i'll keep searching there in the meantime ... here's an example:
Several things I think could be wrong... declaring the variable as string is porbably wrong? Although I tried declaring as As Object and that didn't work! I could also have the syntax in the Me. control wrong although I've tried quotes, square brackets and and signs (&) with no luck!
Does anyone know what is required to make this work?
Thanks guys!
I'm writing some VBA subroutines in an access database...
I want to have a routine which disables a box, etc ... but when I call the routine I would like to specifiy the name of the box in the call, is this possible? I've tried myself but get errors but I don't know the correct syntax though - google is a bit dry on this but i'll keep searching there in the meantime ... here's an example:
Code:
Private Sub someOtherSub
Call disableButton (nextRecordButton)
End Sub
Private Sub disableButton (ButtonName as String)
Me.ButtonName.Enabled = False
End Sub
Several things I think could be wrong... declaring the variable as string is porbably wrong? Although I tried declaring as As Object and that didn't work! I could also have the syntax in the Me. control wrong although I've tried quotes, square brackets and and signs (&) with no luck!
Does anyone know what is required to make this work?
Thanks guys!