[AccessD] Re: Compare first letter of String

Erwin Craps - IT Helps Erwin.Craps at ithelps.be
Mon Mar 21 23:50:17 CST 2005


Or use "select case" for better readability.
I also always use ucase or lcase just in case....

Select case  ucase(left(YourString,1))
	case "A"
	'A stuff

	case "B"
	'B stuff

	case "C"
	'C stuff

	Case else
	'else stuff
End select

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK
Sent: Tuesday, March 22, 2005 6:34 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Re: Compare first letter of String 

Hi Connie
Try something like

	If left(YourString,1) = "A" then
 		'Do the stuff that only A's can do
	ElseIf left(YourString,1) = "L" then
 		'Do the stuff that only L's can do
	ElseIf left(YourString,1) = "P" then
 		'Do the stuff that only P's can do
	Else
		Msgbox "Unknown Auth. Number"
	end if
HTH

Darren


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
connie.kamrowski at agric.nsw.gov.au
Sent: Tuesday, 22 March 2005 4:19 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Re: Compare first letter of String 


I have three sets of Strings to represent Authority Number they begin
with one of three letters A, L or P.

I need to limit access to the reports to the corresponding letter. ie
For the Approval Certificate I only want the Authorities with A at the
start to be able to open this form.

I will put the limitation on the button to open the Certificate but I am
not sure how to do this, do I use the LEFT$


Connie Kamrowski

Analyst/Programmer
Information Technology
NSW Department of Primary Industries
Orange


This message is intended for the addressee named and may contain
confidential information. If you are not the intended recipient or
received it in error, please delete the message and notify sender. Views
expressed are those of the individual sender and are not necessarily the
views of their organisation.


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list