UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Convert Literal To Number., Access 2010    
 
   
mesersmith
post Oct 12 2017, 01:35 PM
Post#1



Posts: 543
Joined: 5-May 11
From: romania, calarasi


Hi, guys!

Is there a way to convert some literals and numbers in numbers?
I mean if I have some serial number, just like 107FMCXMBQT0026C, can I convert this to a number?
In fact, I need to convert every letter and every number in a number.

--------------------
Marius-Romania
Go to the top of the page
 
doctor9
post Oct 12 2017, 01:39 PM
Post#2


UtterAccess Editor
Posts: 17,736
Joined: 29-March 05
From: Wisconsin


mesersmith,

Just as a guideline for the process you are trying to create, what would be the number equivalent of "107FMCXMBQT0026C" that you would like the conversion to return?

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
mesersmith
post Oct 12 2017, 01:41 PM
Post#3



Posts: 543
Joined: 5-May 11
From: romania, calarasi


I think I can use the ascii value of each characters. But I don't know how.

--------------------
Marius-Romania
Go to the top of the page
 
doctor9
post Oct 12 2017, 01:47 PM
Post#4


UtterAccess Editor
Posts: 17,736
Joined: 29-March 05
From: Wisconsin


mesersmith,

> can I convert this to a number
> use the ascii value of each characters

Are you saying you now want 16 separate numbers, since that string is 16 characters long? Would they be comma-separated? Just trying to clarify what you want exactly. Something like this?

CODE
? asclist("107FMCXMBQT0026C")
49,48,55,70,77,67,88,77,66,81,84,48,48,50,54,67


It might help if you explained what you're trying to accomplish with this conversion of the string.

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
mesersmith
post Oct 12 2017, 02:07 PM
Post#5



Posts: 543
Joined: 5-May 11
From: romania, calarasi


Thanks, Doc, for your answer.
That serial number is a motherboard serial, wich I already extracted.
I want to convert this serial to a series of numbers, no comma separated.
This I try to use in a key protection for a database.

--------------------
Marius-Romania
Go to the top of the page
 
doctor9
post Oct 12 2017, 02:36 PM
Post#6


UtterAccess Editor
Posts: 17,736
Joined: 29-March 05
From: Wisconsin


mesersmith,

Well, I suppose you could return "49485570776788776681844848505467" as a string, but that's probably too many digits to return as a number. But if you return a string, you may as well just use the original strong, right?

Is there a reason you can't just use the original string for your "key protection"? Must it be a number?

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
mesersmith
post Oct 12 2017, 02:46 PM
Post#7



Posts: 543
Joined: 5-May 11
From: romania, calarasi


How can I write the formula into a textbox to convert in ascii a text wich is in another textbox?

--------------------
Marius-Romania
Go to the top of the page
 
doctor9
post Oct 12 2017, 02:57 PM
Post#8


UtterAccess Editor
Posts: 17,736
Joined: 29-March 05
From: Wisconsin


mesersmith,

You could write a user-defined function in VBA, then call the function from the textbox.

But again... does it NEED to be a number? Because with that many digits it's at least in the Octillions.

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
John Vinson
post Oct 13 2017, 06:27 PM
Post#9


UtterAccess VIP
Posts: 4,111
Joined: 6-January 07
From: Parma, Idaho, US


So you need to convert an arbitrary string of ASCII characters to a new string of numeric digits? If so your could use a VBA function like:

CODE
Public Function AscString(strIn As String) As String
Dim i As Integer
For i = 1 to Len(strIn)
   AscString = AscString & Asc(Mid(strIn, i, 1)
Next i
End Function

--------------------
John W. Vinson
Wysard of Information
Go to the top of the page
 
doctor9
post Oct 16 2017, 08:25 AM
Post#10


UtterAccess Editor
Posts: 17,736
Joined: 29-March 05
From: Wisconsin


John,

> So you need to convert an arbitrary string of ASCII characters to a new string of numeric digits?

That's what I've been waiting to hear as well. I feel like my question is being ignored.

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th October 2017 - 09:46 AM