f



text field only for text - no numbers

Hi

I would like some help about the following :

I have a text field and I don't want it contains any numbers. How can I
limit
this situation ?

So far, I couldn't find literature exacly about this here in the newsgroup.

TIA
Paulo




0
amigo.alf (1)
10/15/2003 10:56:15 PM
comp.databases.ms-access 42670 articles. 0 followers. Post Follow

2 Replies
944 Views

Similar Articles

[PageSpeed] 48

"Paulo Rodrigues" <amigo.alf@netvisao.pt> wrote in message news:<newscache$kgmtmh$bb1$1@newsfront4.netvisao.pt>...
> Hi
> 
> I would like some help about the following :
> 
> I have a text field and I don't want it contains any numbers. How can I
> limit
> this situation ?
> 
> So far, I couldn't find literature exacly about this here in the newsgroup.
> 
> TIA
> Paulo

Paulo,

the online help is your FRIEND.  

Private Sub Text0_KeyPress(KeyAscii As Integer)

    If KeyAscii >= 48 And KeyAscii <= 57 Then
        KeyAscii = 0
    End If
End Sub

Just put this code in the KeyPress event of whatever text field you do
not want to contain numbers.  OR you could glue thumbtacks to the
number keys on all your users keyboards...
0
pietlinden (2926)
10/16/2003 1:49:29 AM
Thought I'd add my 2 cents worth.  Avoid magic numbers, especially
when you can use builtin VBA constants.  The following is a little
more intuitive to read and a future developer does not have to lookup
48 and 57 to see exactly what is being blocked.

Private Sub Text2_KeyPress(KeyAscii As Integer)
  
  'Cancel any numeric keys
  If KeyAscii >= vbKey0 And KeyAscii <= vbKey9 Then
    KeyAscii = 0
  End If
  
End Sub

The above solution does not stop the user from cutting and pasting a
numeric character. Its often the small things that get you. <g> I have
a couple of generic functions, which do stop the user from pasting
banned characters and it also allows you to add a series of non
consecutive banned characters such as spaces or quotes or commas etc.
Both functions could be modified for speed but I'm lazy and they work
so I've never bothered tweaking them. Pieter's solution is much faster
but does not allow you to easily add a newly banned character for
numerous text boxes by modifying one constant in one place. I couldn't
find the functions, so I rewrote them. You should test them if you use
them and limit the length of the string to the maximum length of the
field.  This will slow down enough to be painful with a huge field so
use it sparingly.  You can also trap the "paste" using API calls and
check the string at this point, which will speed things up
considerably but all of this is overkill for 99% of applications. 
Have fun.  Can you tell I'm bored?  I go sailing in two days for four
weeks so I'm just killing time at work.

'String of banned characters for text boxes
Const fstrBANNED = "0123456789"

'Maximum text box field length
Const flngMAX_LENGTH As Long = 255

Private Sub Text0_Change()
  StripBannedChars Text0
End Sub

Private Sub Text0_KeyPress(KeyAscii As Integer)
  CancelBannedKey KeyAscii, fstrBANNED
End Sub

Public Sub CancelBannedKey( _
  ByRef rintKeyASCII As Integer, _
  ByVal vstrBanned As String)
    
  '********************************************************
  'Purpose: Cancels the key press for all banned
  '         characters specified in the supplied string
  '********************************************************
  
  'Loop through every character in the supplied string
  While Len(vstrBanned) > 0

    'If the key pressed is the specified key, cancel it
    If rintKeyASCII = _
      Asc(Left(vstrBanned, 1)) Then rintKeyASCII = 0
      
    'Strip the leading character
    vstrBanned = Right(vstrBanned, Len(vstrBanned) - 1)
      
  Wend  'more characters

End Sub

Private Function strStripBannedChars( _
  ByVal vstrSource As String, _
  ByVal vstrBanned As String) As String
    
  '********************************************************
  'Purpose: Strips all banned characters from the
  '         supplied source string
  '********************************************************
  
  'Loop through every character in the supplied string
  While Len(vstrBanned) > 0

    'Replace any occurrence of each banned
    'character with an empty string
    vstrSource = Replace(vstrSource, _
      Left(vstrBanned, 1), vbNullString)
      
    'Strip the leading character from the banned characters
    vstrBanned = Right(vstrBanned, Len(vstrBanned) - 1)
      
  Wend  'more characters

  strStripBannedChars = vstrSource

End Function

Public Sub StripBannedChars(ByVal vtxt As TextBox, _
  Optional ByVal vlngMaxLength As Long = flngMAX_LENGTH)
    
  '********************************************************
  'Purpose: Strips all banned characters from the supplied
  '         textbox.  The cursor returns to the start of
  '         the textbox if banned characters are found.
  '********************************************************
    
  Dim strSource As String
  Dim strStripped As String
  
  'The source string to be tested for banned characters
  strSource = vtxt.Text
  
  'The source string with banned characters removed
  strStripped = strStripBannedChars(strSource, fstrBANNED)
  
  'If the source string has any banned characters
  'remove them.  This will trigger this function
  'again.  Beware of recursive event triggers!
  If strSource <> strStripped Then
    vtxt.Text = Left(strStripped, vlngMaxLength)
  End If
  
  'Finished with the local pointer
  Set vtxt = Nothing

End Sub
0
10/16/2003 6:53:45 AM
Reply:

Similar Artilces:

text-text
Wondering how what I input to my UTF-8 terminal gets passed along through my patched [1] trn ... Cyrillic: А Б В Г Д Е Ж З И Й К Л М Н О П а б в г д е ж з и й к л м н о п IPA: ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ [1] https://groups.google.com/d/msg/comp.sys.raspberry-pi/7Z37Hdrm0DM/6aqD-reXFzAJ ...

text + text
What is "text + text" supposed to do right now? It doesn't seem very useful to me. What about making "text + text" as an equivalent for "text || text"? Most strongly-typed programming languages do this. And MS SQL Server too, I think (CMIIW). -- dave ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond: > What is "text + text" supposed to do right now? Nothing. > What about making "text + text" as an equivalent for "text > || text"? Most strongly-typed programming languages do this. And MS SQL > Server too, I think (CMIIW). What would this gain except for bloat? It's not like SQL is utterly compatible with any programming language; users will still have to learn all the operators anyway. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match Peter Eisentraut wrote: >>What is "text + text" supposed to do right now? > > Nothing. Then are these bugs? (7.4.5 and 8.0.0beta1 give same results). Frankly, the current behaviour is quite strange to me. ------------------ =...

Unbound text box, text>255, MS Access/PostgreSQL
Hello. I have the following problem with MS Access/PostgreSQL combination: There is a form in Access that has an unbound text box, used for entering a commentary of a batch of records. There is a DAO Append Query that has a parameter that is passed from the text box using parameter of DAO QueryDef object. I adjusted B7 parameter (Text as LongVarchar) in connection string (ODBC driver) to 1, so that Access links PostgreSQL Text fields as Memo fields in Access. The intention was to be able to enter unlimited length commentary into the field. But, although I can enter unlimited text by using...

rich text in text field
I am using GUIDE for my UI work. (MATLAB 2009b) I would like to display some rich-text (font size change, bold, underline etc) inside a panel. Can I put some rich-text, using html tags, in a text field? For example: <html><b> this is bold </b></html> I know you can do it in table headers. Thank you. ...

Text filtering in a text field
Hi, am new to SKILL and would like to do some text checking and filtering for illegal characters in the text field. Meaning I have a text field in my form that is only to be with text, not any of the symbols (i.e. ~!@#$%^&* and so on). When the user input and saved the fields, those characters won't be allowed to be saved. What will be the best way to filter out only text? Only numbers? Terence <terrylau77@gmail.com> writes: > Hi, am new to SKILL and would like to do some text checking and > filtering for illegal characters in the text field. Meaning I have a > text f...

How to convert Number Field to Text Field
I'm newbie in Filemaker, currently I'm using Filemaker pro v 6.01 on Windows XP. I have a small problem. I'm trying to make a solution for Hotel Rate. I want to change the USD. 0.00 to "Included" for breakfast rate which already included in the room rate. Anybody can help, will be much appreciated. Thanks. "Adhie" <priyadi77@yahoo.com> wrote in message news:ba1b5c27.0404080446.21e110b2@posting.google.com... > I'm newbie in Filemaker, currently I'm using Filemaker pro v 6.01 on > Windows XP. I have a small problem. I'm trying to make a ...

How to import a tab delimited text file into MS Access database
Hi, I have the following task to be done in VC++ 6.0. I have a tab delimited text file that needs to be imported into a MS Access table. The table is created and the table structure is defined using DAO methods. So now I have to fill this table with the data in the text files. For a few rows in the text file, the number of columns could be less than the number of columns in the table. Can anyone please post me the code to do this. Thanks a ton in advance. Pradeep wrote: > I have the following task to be done in VC++ 6.0. We'd be happy to give you the VBA code, but do you really want ...

Text file with numbers and text, want to just read numbers
I have a series of text files I want to read. The files begin with header information. The number of rows of header information changes, there is no commenting symbol such as %%, and the header information sometimes has numbers such as a date or a time. I want to read in the number and only the numbers. This is an example of a file: (Again, the header info changes, different # of lines, different text) Vector Signal [Measurement4]: 09/27/2006, 09:05:24 Units: EU Time Real 0 0.053732 9.6e-005 0.11968 0.000192 0.085483 0.000288 ...

Forcing a New Line in a Text Field in MS Access using VB
Heya! I feel I'm beating an old horse to death with this question but I can't get around the problem. I want to update a text field on a form with a string from a VB module. I need enter/linefeeds in the string. I've tried: Chr(10) & Chr(13) Chr(13) & Chr(10 vbnewline vbcrlf none of which seem to work. I've set the properties for the text box to [Enter Key Behavior] = 'New Line In Field' and [Can Grow] = 'yes'. At the moment, my code looks like this: celsql = celsql _ & "Program: " & encname _ ...

Sorting a Text field like a Number Field
I have a table with around 18,000 records in it. One of the fields is a Text field, but 85% of the things in that field is a number (The other 15% is a number with a text suffix). I was wondering if there was an easy way to Sort this field as if it were a number (because, when it sorts as text it looks like this... 1 11 12 14 2 21 24 3 35 So far, the only thing I came up with was to make a query with this expression... TempSection: CDbl([Section]) But that either produces a #Error for those rows where the Section has a text character in there or it won't even open the query in datasheet view because of Data type mismatch in criteria expression. What can I do? Can I create an iif statement to catch that error? or Something? Thanks! -- Nathan Try this: sc:iif(isnumeric(x!y),cdbl(x!y),0) where X is table and Y is field. Sort on this but display y. This will place all fields containing text at the top and then sort numbers. If you want all text fields at the bottom then change 0 to 99999999. If you really need to sort the text contianing fields as well you will need a funtion to extract the numeric part and use that as the arguement to cdbl. You wouldn't need the iif function then. Good Luck Ira Solomon On 5 Oct 2003 16:31:25 -0700, ngiven@hotmail.com (Nathan Given) wrote: >I have a table with around 18,000 records in it. One of the fields is >a Text field, but 85% of the things in that fiel...

Get the real type of columns from MS Access databases(OLEObject, text, memo, numeric)
Hello, I made one application that opens MS Access databases.And I have one problem.How can I find the real data type of columns(text, memo, OLEObject, numeric) like it is into Access.I tried with resultSetMetaData.getColumnType(columnIndex) but I receive java.sql.Types.I have two columns that contains OLEObjects(images).But I receive two different types for columns : VARCHAR once, and for second column SMALLINT.I only want to see the types like in Access(OLEObjects, Text, Numeric, Memo...).Thanks in advance! Best regards, Calin Pop ...

problem with importing text with number and text
i am trying to import a csv file (~49000 rows x 52 cols) with numbers text and characters in it and not getting through. xlsread works fine with all my data except the first column of data which is a time stamp. it converts the time stamps into a constant value through the entire column. To add to the problem, when opened as a text file, every row of the file starts with a comma. I got very close with textscan/textread with all the data coming in but all the rows are transposed into one column one above the other ( imagine 49000 rows 52 cells long transposed one above the other in one column c...

Insert text file in a text field ...
Hallo, I have 2 questions: 1) How can I insert a text file into a TEXT field of a table (by an sql instruction) ? 2) How can I insert a microsoft word file into a BLOB field of a table (by an sql instruction) ? Please, could you help me ? Thank you . Fab. On Thu, 18 Oct 2007 06:41:52 -0700, electric_r@yahoo.it wrote: > Hallo, > > I have 2 questions: > > 1) How can I insert a text file into a TEXT field of a table (by an > sql instruction) ? > > 2) How can I insert a microsoft word file into a BLOB field of a table > (by an sql instruction) ? > > Please, could you help me ? This is a task for the application program, not the database itself. -- A way of life that is odd or even erratic but interferes with no rights or interests of others is not to be condemned because it is different. -- Chief Justice Warren E. Burger electric_r@yahoo.it wrote: > Hallo, > > I have 2 questions: > > 1) How can I insert a text file into a TEXT field of a table (by an > sql instruction) ? > > 2) How can I insert a microsoft word file into a BLOB field of a table > (by an sql instruction) ? > > Please, could you help me ? > > Thank you . > > Fab. Look at the LOAD_FILE() function in the manual On 18 Oct, 14:41, electri...@yahoo.it wrote: > Hallo, > > I have 2 questions: > > 1) How can I insert a text file into a TEXT field of a table (by an > sql instruction) ? > > 2) How can...

Accessing text form fields name=field[label]
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a database search that I am unable to figure out how to access. (The search is implemented in Php/MySQL.) The user enters search values for: name, address1, city, .... etc., ..... and for each of these they also select whether the search should look for the field to be equal to, not equal to, Like, or Not Like the value in the database. So in the form I have: <input type=text name=city> in combination with <select name=func[city]> <option value='='>=</option> <option value='!='>!=</option> <option value='LIKE'>LIKE</option> <option value='!='NOT LIKE>NOT LIKE</option> </select> For an example, this search could be to find an entry "WHERE city $func[city]] $city. (Php - e.g., WHERE city = 'Denver'). This works fine - in Php. I use similar combinations for name, address, etc., ... Okay, here's the JavaScript problem. For the Reset action I have a JavaScript function to Reset all the form fields. I want to Reset the selected indexes for the "func" fields (func[name], func[city], func[state], ...) using a loop that goes through the associative array, "func." I cannot find the right syntax to address them as an array and I am beg...

reading in file with text and numbers to be able to access numbers
Hi. I am trying to read in a file that was created by another application. The first two lines of this file are composed of text that I don't need. Following are 100 lines of numbers that I do need. Any idea on how to load this file without making an overly specific script? The number of rows of numbers the other application generates varies. Thank you for any tips! Look at the TEXTREAD function. One of the options is 'headerlines', to tell it the number of lines to skip at the beginning of the file. So you would do something like this: n = textread('myfile.txt','...

Wrapping Text
I'm trying to export an Access table to a pipe-delimited text file (with no text qualifier) and it keeps wrapping the text for one of the tables. None of the fields are particularly long, so I'm not sure why it's doing this. Any ideas how I can stop it from wrapping the text in the text file? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200803/1 Leviathan wrote: >I'm trying to export an Access table to a pipe-delimited text file (with no >text qualifier) and it keeps wrapping the text for one of the tables. N...

Old ms-access file, showing wrong text in access xp
Dear sirs: I've one old .mdb file ( since 97). now when I open it, it converts most of text to strange unicode characters. can I stop this conversion and ask access to just show original non-unicode characters? Thanks Bijan ...

Musatov exposes R.S.A. vulnerability: Blue highlight black text truncates black background text turning it white black foreground text remains in field.
505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f7071 72737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969 798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3 505152535455565758595a5b5c5d5e5f606162HMAC/SHA-256 Large Correct: Superposition of lines 1 and 4 will correct R.S.A. example: http://il8n.co/test.html ...

Quickly adding text to a mysql text field that is NOT empty
Hi all Is there a way to insert text into a mysql text field that already has text into it; without having first to extract the existing data and append the new text to that string variable and then insert the new string. Basically i'm looking for a way to do it with a single query not 2 (one being a select to gather existing data). Please help! I could have sworn I already replied to this but it appears that it did not go through, but anyway; you want to modify the contents of an existing field without having to fetch it using a query, yes? This is possible through the use of MySQL&#...

Text from required text box to read-only text box
Hello, I am fairly new to JavaScript and its use in Acrobat Professional. My situation is this: I have a form with a text box field which is required for the user to enter his/her name. I would like the required text box to display the name in all caps. I also need the user's name to appear in a read-only text box later in the form, which I would like to have the first letter of the user's first, middle initial, and last names to be capitalized. I would also like to have all required fields on the form highlighted in yellow, but the highlighting not printed. Lastly, I would like the...

Surrounding text with text
I was wondering if it was possible to surround a text body with text like so: +--------------+ |ABCDEFGHIJKLM | |H N| |A Main Body O| |L Text goes P| |B here Q| |-=+_ZYXWVUTSR | | | | | | | | | +--------------+ This seems far-fetched, but just curious. I suppose that I could just move stuff around by hand in the GIMP later on, but there's probably a {better,more {extensible,clean}} way of doing it from (La)TeX. -FreeSmith ptjm@interlog.com (Patrick TJ McPhee) wrote in message news:<bffbhe$per$1@news.eusc.inter.net>... > Peter Flynn had an example like that, which he either posted here or > posted a link here. It was something to do with a certificate -- try > searching for his name and that word in google. > > It wouldn't be hard to do with metapost. I have a macro called `pathalong' > which puts text along an arbitrary path. Well, it's been a while, but I finally finished it. It's a little job I was doing for an upcoming wedding. At any rate, I used pstricks to make the text go along a path, along with a couple of hacks for sizing (from graphicx) and kerning along the line (from soul). Here's the code (don't laugh): CAUTION:THIS CODE MAY MAKE YOU WRETCH ---SNIP--- \documentclass{article} \usepackage{graphicx} \usepackage{pstricks,pst-text,nopageno} \usepackage[width=8.5in]{geometry} \usepackage{soul} \begin{document} \thispagestyle{empty} \set...

Windows 7 style Text Fields backgound text
Hi is there a way to get a background text in entry fields (text presenters) in the entry area itself - that disappears when you start typing - i.e. Windows 7 style. (Is there any special name / buzzword for that feature ?) Regards Sanjay Sanjay, >is there a way to get a background text in entry fields (text >presenters) in the entry area itself - that disappears when you start >typing - i.e. Windows 7 style. If you don't mind the test being selected then this should work. Select all the following and evaluate in a workspace... sh := Shell show. sh v...

Sorting Numbers in a Text Field
One field in my database contains the dosage of medicines. It's a text field since I have to include the units. Here's a list of what might be in the field: 10 mg 20 mg 50 mg 100 mg When I sort I want them to appear as I listed them above. However, they appear as 10 mg 100 mg 20 mg 50 mg Any suggestions for solving this problem? Rich This question has been answered multi times before. You have entered the numbers in a text field so they are sorted on their ascii value and not on their numeric value. Put the numbers in a number field, leave the mg part out (since it is always mg...

Updating A Text String In A Text Field With An Update Query
If I have the following string in a text field of a table: "This is a test" can I create an update query that will change, say, the string "is" to "xyz" in the two locations where it occurs or would this require VBA? Thanks, Sheldon Potolsky Use an Update query. Something like this: UPDATE Table1 SET [F1] = Replace([F1], "is", "xyz") WHERE [F1] Like "*is*"; -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps ...

Web resources about - text field only for text - no numbers - comp.databases.ms-access

Number - Wikipedia, the free encyclopedia
A number is a mathematical object used to count , label, and measure . In mathematics , the definition of number has been extended over the years ...

Number - Wikipedia, the free encyclopedia
A number is a mathematical object used to count , label, and measure . In mathematics , the definition of number has been extended over the years ...

Queensland suburbs house the highest number of drug labs in Australia
Dangerous backyard labs in Queensland pose dangers beyond drugs.

Mathematicians stunned by 'unrandomness' discovery of prime numbers
The infinite world of prime numbers just got a little more finite, after a pair of mathematicians discovered the prime number sequence isn't ...

Mathematicians stunned by 'unrandomness' discovery of prime numbers
The infinite world of prime numbers just got a little more finite, after a pair of mathematicians discovered the prime number sequence isn't ...

Rooster amnesty declared to reduce Hobart's growing number of rogue fowl
Hobart's chicken owners are asked to surrender unwanted roosters to a special amnesty at the city's showgrounds.

Girlish Number TV Anime Casts Sayaka Senbongi, Kaede Hondo, Yui Ishikawa
Series centering on on idol voice actresses to air on TBS, BS-TBS

A huge number of short bets on Ocado went horribly wrong this morning
Ocado stock popped up 7% this morning after the company reported stronger than expected sales. This is good news for the company, and good news ...

International Student Numbers At U.S. Colleges Grew At The Fastest Rate In 35 Years
Overseas enrollments are a lucrative source of tuition fees for U.S. colleges, and NYU is leading the charge to recruit more.

Seoul: Number of North Korean cyberattacks doubled in month
SEOUL, South Korea (AP) — South Korea's spy agency told lawmakers Friday that the number of North Korean cyberattacks on the South has doubled ...

Resources last updated: 3/16/2016 1:10:07 AM