Prev: vertragen
Next: access 2007 add contacts from outlook
From: alex on 21 Jan 2010 12:45 Check List in VBA Hello, Im looking for advice on the following: Lets say you wanted to check a list of values (same data type, same length, etc) without using a table in VBA. Something like If strValue in ( Value1, Value2, Value3, ValueN) Then do something With a short list, a simple case statement would suffice, but because of its structure (TestExpression), (ExpressionList), (StatementBlock), it could get rather long. What Im trying to do is verify a list of user IDs in code without using a table object (which would be linked). Am I crazy or can/should this be done easily? My reasoning is that its faster and while not super secure, more secure than a table. Thanks, alex
From: Tom Wickerath AOS168b AT comcast DOT on 21 Jan 2010 16:31 Hi Alex, You can use the InStr function. Something like this: strValues = "User1, User2, User3, User4, ....." If InStr (strValues, strSearch) > 0 Then 'we found a match Do something End If where strSearch is the value you are looking for. Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ __________________________________________ "alex" wrote: > Check List in VBA > > Hello, > > I'm looking for advice on the following: > > Let's say you wanted to check a list of values (same data type, same > length, etc) without using a table in VBA. > > Something like… > If strValue in ( > Value1, > Value2, > Value3, > ValueN) > Then do something > > With a short list, a simple case statement would suffice, but because > of its structure (TestExpression), (ExpressionList), (StatementBlock), > it could get rather long. > > What I'm trying to do is verify a list of user ID's in code without > using a table object (which would be linked). > > Am I crazy or can/should this be done easily? My reasoning is that > it's faster and while not super secure, more secure than a table. > > Thanks, > alex > . >
From: alex on 22 Jan 2010 06:29 On Jan 21, 4:31 pm, Tom Wickerath <AOS168b AT comcast DOT net> wrote: > Hi Alex, > > You can use the InStr function. Something like this: > > strValues = "User1, User2, User3, User4, ....." > > If InStr (strValues, strSearch) > 0 Then 'we found a match > Do something > End If > > where strSearch is the value you are looking for. > > Tom Wickerath > Microsoft Access MVPhttp://www.accessmvp.com/TWickerath/ > __________________________________________ > > > > "alex" wrote: > > Check List in VBA > > > Hello, > > > Im looking for advice on the following: > > > Lets say you wanted to check a list of values (same data type, same > > length, etc) without using a table in VBA. > > > Something like > > If strValue in ( > > Value1, > > Value2, > > Value3, > > ValueN) > > Then do something > > > With a short list, a simple case statement would suffice, but because > > of its structure (TestExpression), (ExpressionList), (StatementBlock), > > it could get rather long. > > > What Im trying to do is verify a list of user IDs in code without > > using a table object (which would be linked). > > > Am I crazy or can/should this be done easily? My reasoning is that > > its faster and while not super secure, more secure than a table. > > > Thanks, > > alex > > .- Hide quoted text - > > - Show quoted text - Thanks Tom for the help; I never thought of using that function! I was hoping to go vertical with the list (might be easier to maintain) but VBA only allows a certain number of continuation characters ( _ ). alex
From: Tom Wickerath AOS168b AT comcast DOT on 24 Jan 2010 02:09 Hi Alex, I've never heard of any limit for the number of line continuation characters....what limit have you determined? The best place for data is to store it in a table. You could then open a recordset, and look for a match. But, you indicated in your opening post that you are trying to accomplish this goal without using a table. Tom Wickerath Microsoft Access MVP http://www.accessmvp.com/TWickerath/ __________________________________________ "alex" wrote: > > Thanks Tom for the help; I never thought of using that function! > I was hoping to go vertical with the list (might be easier to > maintain) but VBA only allows a certain number of continuation > characters ( _ ). > alex
From: John Spencer on 24 Jan 2010 11:09
In Access 2003 I was allowed 24 before I got an error message about too many line continuations. There is also a line length restriction - which I don't recall at this time. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County Tom Wickerath wrote: > Hi Alex, > > I've never heard of any limit for the number of line continuation > characters....what limit have you determined? > > The best place for data is to store it in a table. You could then open a > recordset, and look for a match. But, you indicated in your opening post that > you are trying to accomplish this goal without using a table. > > > Tom Wickerath > Microsoft Access MVP > http://www.accessmvp.com/TWickerath/ > __________________________________________ > > "alex" wrote: >> Thanks Tom for the help; I never thought of using that function! >> I was hoping to go vertical with the list (might be easier to >> maintain) but VBA only allows a certain number of continuation >> characters ( _ ). >> alex |