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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function to set values 1

Status
Not open for further replies.

NiceArms

Programmer
May 21, 2009
105
GB
Hi all,

I created a function that was to re-set the values in a text box i.e. textbox1 = 1 and when the function is run the textbox is to return to 0

Call the function:
Reset_Values ("txtScore") 'txtscore is the name of the textbox

The function:
Private Function Reset_Values(Field1 As String) As Integer
Reset_Values = Field1.Value = 0
End Function

The error i get is:
"Compile error: Invalid Qualifier"

Can anyone see where I am going wrong?

/Nice
 
Try
Private Function Reset_Values()
Field1= 0
End Function
 
Not sure what this function is supposed to return, does not make sense to me. Looks like a sub routine not a function. Looks like you want to pass in a control name and set that control's value to 0.

call Reset_Values("txtScore")

Private sub Reset_Values(cntrlName As String)
me.controls(cntrlName) = 0
End Function
 
call Reset_Values("txtScore")

Private sub Reset_Values(cntrlName As String)
me.controls(cntrlName) = 0
End Function "

This worked a treat.

Apologies for not being clear, however I am a little new to this.

/Nice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top