Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 13th, 2007, 08:45 PM
Registered User
 
Join Date: Feb 2007
Location: Teaneck, NJ, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using the Asc function

Hi,

I'm new to this site and am hoping someone can help. I'm trying to find the ascii value of text entered into a text box. I've written the following code on the Key press event of a text box, but every time I type something in, I get a "Invalid procedure call or argument" error. Do I need to have a specific reference turned on or is there an issue with my code?

Thanks in advance for your help!

    Private Sub txt_String_KeyPress(KeyAscii As Integer)

         Dim Asc_Value As String

         Asc_Value = Asc(Me.txt_String.Text)
         MsgBox Asc(Asc_Value)


    End Sub



--LANGSHA--
Reply With Quote
  #2 (permalink)  
Old February 20th, 2007, 04:42 AM
Registered User
 
Join Date: Oct 2006
Location: chennai, tamil nadu, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to kumarj
Default

Try to split the string and use asc() function

Reply With Quote
  #3 (permalink)  
Old March 29th, 2008, 02:54 AM
Registered User
 
Join Date: Mar 2008
Location: Eorde, TN, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Option Explicit
Public ascval As String
-------------------------------------------------------
Private Sub txt_String_KeyPress_KeyPress(KeyAscii As Integer)
ascval = ascval & KeyAscii
End Sub
---------------------------------------------------------------
Private Sub txt_String_KeyPress_KeyUp(KeyCode As Integer, Shift As Integer)
txt_String_KeyPress = ascval
End Sub
Reply With Quote
  #4 (permalink)  
Old November 25th, 2008, 12:13 PM
Registered User
 
Join Date: Nov 2008
Location: Bronx, NY, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

KeyAscii is the Ascii value for the key you pressed while in your textbox named txt_String. The KeyPress event tracks each time you press a key, hence the name.

You are receiving the error "Invalid procedure call or argument" because you are providing an invalid argument to the Asc() function. The Asc() function takes a single text character. You can only get the Ascii value of a single character.

That being said, what are you trying to accomplish?

Allan






Quote:
quote:Originally posted by langsha
 Hi,

I'm new to this site and am hoping someone can help. I'm trying to find the ascii value of text entered into a text box. I've written the following code on the Key press event of a text box, but every time I type something in, I get a "Invalid procedure call or argument" error. Do I need to have a specific reference turned on or is there an issue with my code?

Thanks in advance for your help!

    Private Sub txt_String_KeyPress(KeyAscii As Integer)

         Dim Asc_Value As String

         Asc_Value = Asc(Me.txt_String.Text)
         MsgBox Asc(Asc_Value)


    End Sub



--LANGSHA--
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get charactor from Asc value hiruni Beginning VB 6 2 February 7th, 2006 10:51 PM
ASC function Error JpJoe Access 3 May 22nd, 2005 01:36 AM
ORDER BY id ASC gilgalbiblewheel Classic ASP Databases 1 January 5th, 2005 12:20 AM
How to put Desc/Asc triangle symbol on List View? hplim18 VB How-To 1 May 10th, 2004 12:17 PM
retreive function/Line from macro or function? MikoMax J2EE 0 April 1st, 2004 04:42 AM



All times are GMT -4. The time now is 04:55 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.