Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing control name into a public function

Status
Not open for further replies.

benwah

Technical User
Jun 27, 2001
97
GB
Hi

The problem I am having is when I use the parameter passed by the function as a control name. Any ideas?

Public Function EmpAgeCheckRed(txtField As Control)

Dim RedColor As Long

RedColor = RGB(255, 0, 0)

Me![txtField].BorderColor = RedColor

End Function


Thanks in advance
wah
 
what is the error your getting? Is this a module or behind the currrent for? If it is in A module pass the form and do the manipulation like so.

Public Function EmpAgeCheckRed(frmCurrent As Form)

Dim RedColor As Long

RedColor = RGB(255, 0, 0)

frmCurrent![txtField].BorderColor = Cstr(RedColor)

End Function

Also when setting a properties box it needs to be as a text value.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top