Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asc and Chr Functions 1

Status
Not open for further replies.

Swi

Programmer
Feb 4, 2002
1,963
0
36
US
Do the Asc function and Chr functions in VB exist in any way in FM6?

Swi
 
In FM6 you need a calculation to generate the values.

In FM +6, you can make a custom function.
 
I have been reading books and some online tutorials but have not used the actual product yet. I will be using it for the first time next week. I was looking into calculations but could not find anything that correlated to the Asc and Chr functions in VB. Thanks for the info.

Swi
 
Thanks. I will look into it.

Swi
 
That is great. The Chr function converts the specified ANSI character code to a character.

Swi
 
Again, that link you provided should work but what I am trying to accomplish is recreating the following VB code:

Code:
Public Function Bar128AB(BarTextIn As String, Subset As Integer) As String

' Initialize input and output strings
BarTextOut = ""
BarTextIn = RTrim(LTrim(BarTextIn))

' Set up for the subset we are in
If Subset = 0 Then
  Sum = 103
  StartChar = "{"
Else
  Sum = 104
  StartChar = "|"
End If

' Calculate the checksum, mod 103 and build output string
For II = 1 To Len(BarTextIn)
  'Find the ASCII value of the current character
  ThisChar = (Asc(Mid(BarTextIn, II, 1)))
  'Calculate the bar code 128 value
  If ThisChar < 127 Then
    CharValue = ThisChar - 32
  Else
    CharValue = ThisChar - 103
  End If
  'add this value to sum for checksum work
  Sum = Sum + (CharValue * II)

  'Now work on output string, no spaces in TrueType fonts, quotes replaced for Word mailmerge bug
  If Mid(BarTextIn, II, 1) = " " Then
    BarTextOut = BarTextOut & Chr(228)
  ElseIf Asc(Mid(BarTextIn, II, 1)) = 34 Then
    BarTextOut = BarTextOut & Chr(226)
  ElseIf Asc(Mid(BarTextIn, II, 1)) = 123 Then
    BarTextOut = BarTextOut & Chr(194)
  ElseIf Asc(Mid(BarTextIn, II, 1)) = 124 Then
    BarTextOut = BarTextOut & Chr(195)
  ElseIf Asc(Mid(BarTextIn, II, 1)) = 125 Then
    BarTextOut = BarTextOut & Chr(196)
  ElseIf Asc(Mid(BarTextIn, II, 1)) = 126 Then
    BarTextOut = BarTextOut & Chr(197)
  Else
    BarTextOut = BarTextOut & Mid(BarTextIn, II, 1)
  End If
Next II

' Find the remainder when Sum is divided by 103
CheckSumValue = (Sum Mod 103)
' Translate that value to an ASCII character
If CheckSumValue > 90 Then
  CheckSum = Chr(CheckSumValue + 103)
ElseIf CheckSumValue > 0 Then
  CheckSum = Chr(CheckSumValue + 32)
Else
  CheckSum = Chr(228)
End If

'Build ouput string, trailing space is for Windows rasterization bug
BarTempOut = StartChar & BarTextOut & CheckSum & "~ "

'Return the string
Bar128AB = BarTempOut
End Function

My question is, since I have not messed with FM6 much is can this function be recreated in FM6?

Swi
 
This is the software that I requested the company to buy before I was coming there but unfortunately their IT consultant told them to buy something from Elfring fonts. They only provide source code in VBA which is the above source code.

Swi
 
I walked away from Elfring, what I used in my DBIII developer period, years ago,when I switched to FileMaker.

Sorry, can't help you here.
Back then Elfring was not compatible with FileMaker and they still not support FM.

For one of my customers I use the font from

maybe that can help you....
And it supports Code 39 and 128
 
Thanks. I will look into it. I would assume that you would use IDAutomation over the link above if you had a choice. Thanks again.

Swi
 
For what I need, yes.

The whole productline of IDAutomation gives me all I need...for now.
 
Thank you for all of the options. Maybe I can talk them into buying one of the above packages. Thanks.

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top