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

The Left Function - why doesn't it work?!

Status
Not open for further replies.

RobWalls

Programmer
Jul 25, 2001
15
0
0
GB
I've been trying to use the Left function to return a single character from the start of a combo-box text bit, but it keeps coming up with an error saying "Unknown class module" or something similar. The syntax i'm using is: Left(string, n)
My code looks like this:

If Left(combo.text, 1) = 0 Then
Effect = 0
Else
Effect = 1
End If

The error highlights the word "Left" in the above code. I've used exactly this code in VB6 with no trouble, so what's the difference? I'd be grateful for any help.
Thanks for your time,

Rob.
 
combo.value instead of text ? also where are you placing the code ?
 
probably attempting to use the "Text" property. The default for a textbox is Value not Text, try it without the .Text

If this doesn't correct the problem then
Check for a Missing Library Reference

Open any Module in Design Mode, Click on Tools then References on the MenuBar

Look for any reference with "Missing" next to it. If one exists, then click on the checkbox next to it and close the dialog box.
If no reference has "Missing" next to it then click on any unchecked reference, and close the dialog box. Reopen and unclick that reference and reclose the dialog box.

PaulF
 
In the event all that fails, restart your computer and try again. Yes, I know that seems nuts, but I just had a similar problem last night and that resolved it.

Gary
gwinn7
 
Thankyou all!
I'm not sure what the heck happened, but through some combination of checkboxes, rebooting, typing ".Value" and generally hitting the PC, it now seems to work!
Rob.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top