473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Extracting Numeric Strings Problem

Hello People,

I am a newbie here, and if I make some stupid mistakes please forgive me :)

I have found this site very helpful, and was hoping someone could solve a problem I have.

I have created a module in Access, Office 2003. The module is supposed to extract numeric strings from a field on a form and place entries in a sub form.

The code below is how I have tried to do this...



Option Compare Database

Public Function FindUrns_Click()
Dim dbs As Database
Set dbs = CurrentDb
Dim TPURN As String
Dim URN As String
Dim URNLen As Integer
Dim Lp As Integer


Forms!URNS!URNS.SetFocus
DoCmd.GoToRecord , , acFirst
URN = Forms!URNS!URNS
Lp = Len(URN)
'Start loop for record strings
Do While Lp > 1
Forms!URNS!URNS.SetFocus
URN = Forms!URNS!URNS
URNLen = Len(URN)
If IsNumeric(Left(Forms!URNS!URNS, 1)) Then
Do While IsNumeric(Left(Forms!URNS!URNS, 1))
URNLen = Len(URN)
TPURN = TPURN & (Left(Forms!URNS!URNS, 1))
Forms!URNS!StringsSubform!NumericString = TPURN
Forms!URNS!URNS = Right(Forms!URNS!URNS, URNLen - 1)
Loop
Forms!URNS!StringsSubform.SetFocus
DoCmd.GoToRecord , , acNext
Else
Forms!URNS!URNS = Right(Forms!URNS!URNS, URNLen - 1)
Forms!URNS!StringsSubform!NumericString = Forms!URNS!StringsSubform!NumericString & TPURN
End If
Lp = Len(URN)
Loop


'End Loop


End Function


The problem is when a numeric string is found the second number is repeatedly entered as the do while loop seems to get stuck, causing and error as the maximum field size gets reached as the module doesn't move through the string, I don't understand why this is.

Please help I cannot see where I am going wrong!!

Thanks in advance.
May 17 '07 #1
3 1460
kepston
97 Expert
As I understand it, when you use Forms!URNS!URNS it reads the current value, but does not update it until you exit the control. So in effect you are always reading the same character.

You have the line
URN = Forms!URNS!URNS

so parse the variable URN instead

URN = Right(URN, URNLen - 1)
May 17 '07 #2
:) YOU'RE A STAAARRRRR

My manager likes you
May 17 '07 #3
kepston
97 Expert
:) YOU'RE A STAAARRRRR

My manager likes you

Glad to help!
Thanks for the compliment.
May 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: success_ny | last post by:
Does anyone have a code snippet to compare those values so I can sort the array of alpha-numeric values that include both characters and integers in it? I.e., if we have values like 4236 and...
1
by: Scott Smith | last post by:
Several attributes and interface methods I'm using refer to resources (such as strings or icons) by a numeric ID. This was the only way to refer to resources in unmanaged code (C++, for example),...
7
by: Raphi | last post by:
Hi, I'm trying to clean up a large database in Access. I have one field for address, which needs to be broken up into Street Number, Street Name, and Street Label (St., Road, etc.) The...
20
by: MLH | last post by:
120 MyString = "How many copies of each letter do you need?" 150 MyVariant = InputBox(MyString, "How Many?", "3") If MyVariant = "2" Then MsgBox "MyVariant equals the string '2'" If...
2
by: goetzie | last post by:
I am using Python 2.4.1 and Numeric 23.8 and running on Windows XP. I am passing a Numeric array of strings (objects) to a C Extension module using the following python code: import Numeric...
2
by: CoreyWhite | last post by:
Problem: You have numbers in string format, but you need to convert them to a numeric type, such as an int or float. Solution: You can do this with the standard library functions. The...
4
by: Debbiedo | last post by:
My software program outputs an XML Driving Directions file that I need to input into an Access table (although if need be I can import a dbf or xls) so that I can relate one of the fields...
6
by: geegeegeegee | last post by:
Hi All, I have come across a difficult problem to do with extracting UniCode characters from RTF strings. A detailed description of my problem is below, if anyone could help, it would be much...
10
by: Mikesinfo | last post by:
Hi everyone, Hopefully this is the right forum to use. I am programming in C# and I've been racking my brain and searching for the right answer to extract my information according to after a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.