Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.access.modulesdaovba,microsoft.public.excel.programming
dcs dcs is offline
external usenet poster
 
Posts: 2
Default validating against a list - Please Help!

I am wanting to validate numbers as they are keyed in against a list of valid numbers. For example, I will have a list of 1000 - 9 digit numbers, and I would like to check a number as it is entered against that list. Furthermore, I would like a valid number, once entered to no longer be valid, or only be allowed to be entered once

For instance, my valid numbers list is 800000001-800000999 and when 800000235 is eneterd it is determined to be valid, however I do not want that exact number to be allowed again

I imagaine that this can be done in either Excel or Access and I am fine with using either

Any help would be greatly-greatly appreciated

Thanks

dcs
  #2   Report Post  
Posted to microsoft.public.access.modulesdaovba,microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default validating against a list - Please Help!

Hi
have a look at
http://www.cpearson.com/excel/NoDupEntry.htm
for preventing duplicate entries.

--
Regards
Frank Kabel
Frankfurt, Germany

"dcs" schrieb im Newsbeitrag
...
I am wanting to validate numbers as they are keyed in against a list

of valid numbers. For example, I will have a list of 1000 - 9 digit
numbers, and I would like to check a number as it is entered against
that list. Furthermore, I would like a valid number, once entered to no
longer be valid, or only be allowed to be entered once.

For instance, my valid numbers list is 800000001-800000999 and when

800000235 is eneterd it is determined to be valid, however I do not
want that exact number to be allowed again.

I imagaine that this can be done in either Excel or Access and I am

fine with using either.

Any help would be greatly-greatly appreciated.

Thanks,

dcs


  #3   Report Post  
Posted to microsoft.public.access.modulesdaovba,microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default validating against a list - Please Help!

?B?ZGNz?= wrote in
:

For instance, my valid numbers list is 800000001-800000999 and when
800000235 is eneterd it is determined to be valid, however I do not
want that exact number to be allowed again.


All on one line:

= DCount("*","ValidNumbers","IDNumber = " & SuggestedNumber) 0 AND _
DCount("*","ActualTable","IDNumber = " & SuggestedNumber) = 0


This works if (a) you delete records from ActualTable and (b) you are
allowed to re-use the numbers. If you don't want to re=use them, you need

= DCount("*", "ValidNumbers", _
"IDNumber = " & SuggestedNumber & " AND Used = False")

but if you have multiple users you run the risk of reading the value twice
and trying to use it twice (IYSWIM). In that case you have to set the flag
before using it:

strSQL = "UPDATE ValidNumbers SET Used = TRUE " & _
"WHERE IDNumber = " & SuggestedNumber

db.Execute strSQL, dbFailOnError

If db.RecordsAffected = 0 Then
MsgBox "That number was not available"

Else
' It was okay

End If

Hope that helps (PS I have not tested any of this code!!)

Tim F


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
validating Philashley Excel Discussion (Misc queries) 2 March 13th 08 03:54 PM
vlookup and validating data list Donna Excel Worksheet Functions 11 February 29th 08 06:05 AM
Modifying a validating list [email protected] Excel Discussion (Misc queries) 1 January 25th 07 12:34 AM
validating a list of multiple columns grumpy Excel Worksheet Functions 1 December 19th 06 06:27 AM
Validating Sdbenn90 Excel Discussion (Misc queries) 0 March 27th 06 12:05 AM


All times are GMT +1. The time now is 04:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"