unexpected Character displayed in runtime.

craigachan

Registered User.
Local time
Today, 07:32
Joined
Nov 9, 2007
Messages
285
Has anyone gotten unexpected characters in runtime? I'm using A2007 and this does not cause or display any funny characters. But when I bring up the same record in runtime, I have a few extra characters displaced in a field. I'm not sure what these characters are. On of the ones I get often is a question mark inside of a square.

Can anyone offer me a clue what to do about these or where to look?
 
are you using any other vesion of access as well as 2007?

have you tried google?
 
No Just A2007 and the runtime that comes with it.
 
Here is the line of code that is producing the funny character.

fIP.Note = fIP.PreNote & "#" & fIP.tempSite & fIP.PostNote & fIP.tempImplant

The funny characters mentioned comes after the "#" and seems to be associated with Ampersands. But only the ones before and after the 'fIP.tempSite', and not the others.
 
oh, ok. well it must be an xml thing (you know, how office 2007 is now xml based)... (edit.. i think?)

from my html experience, writing anything (in the script) like "#&xxx;" depicts a 'funny' character, or symbol.

for example, the degrees sign is #&186; (if you are typing on a keyboard and need to put in the degrees sign, you would normally type ALT+0186 (or for laptops Fn+Num lk, ALT+0186)).

the muliptly sign (×) is "#&215;"
the o+umlaut character (ö) is "#&246;"

perhaps this is to do with that. you probably have something in you values that have ampersands... and a particular combination in ac2007 transforms it to a symbol or special character.

can you give an end-result example? i.e., what do you expect to see from you data, and what do you actually see (what does access generate)?
 
Last edited:
Here is what it looks like if I cut and paste directoy from the field.

#4 4/17/2009 IMPLANT PLACEMENT -
#11
, 12
, 13
, 14
- Astra

I've also attached the image to this post. Have never attached a file here but it's called 'FunnyChar.jpg'. If you can't find the file, I can email it to you. It shows a screen copy image of the characters and also I copy/pasted to notepad to see what it looks like.
 

Attachments

  • FunnyChar.JPG
    FunnyChar.JPG
    20.4 KB · Views: 122
ok i got my html scripting mixed up! it's &#xxx; not #&xxx;

i think this is what is causing your problem. it seems that you actually have the hash character ("#") in your values?

(these following characters are what i get if i type in "& #11;" (without the space) and increment by one each time. i think the forum displays it slightly differently to 'html', but you get the idea...)














what are the actual values in your table? and can you post your db for us to look at?
 
Last edited:
but this would still not cause the ampersands in your code to stuff up the end result, i wouldn't have thought... so there's got to be something else amiss here. (hence why it would be helpful for a sanitized version of your db - coz this is not a usual problem - not one i've seen anyhow)
 
I've posted 2 lines of of code.

This one produces the funny char:
fIP.Note = fIP.PreNote & " #" & fIP.tempSite & fIP.PostNote & fIP.tempImplant

This one does not:
strInsert = vbCrLf & vbCrLf & "********** " & Date & " POST-OP VISIT - #" & Me.ImpHeader

I've attached a picture of the results 'FunnyChar1.jpg' see below.

Any solutions or comments would be appreciated.
 

Attachments

  • FunnyChar1.JPG
    FunnyChar1.JPG
    18.6 KB · Views: 107
I've posted 2 lines of of code.

This one produces the funny char:
fIP.Note = fIP.PreNote & " #" & fIP.tempSite & fIP.PostNote & fIP.tempImplant

This one does not:
strInsert = vbCrLf & vbCrLf & "********** " & Date & " POST-OP VISIT - #" & Me.ImpHeader

I've attached a picture of the results 'FunnyChar1.jpg' see below.

Any solutions or comments would be appreciated.

have you tried:

Code:
fIP.Note = fIP.PreNote & " #" & fIP.tempSite & [COLOR=Red]", " &[/COLOR] fIP.PostNote &[COLOR=Red] ", " & [/COLOR]fIP.tempImplant

as for your two examples, they look like completely different fields, but your image show something very similar in the end result - why don't you just use the Me.ImpHeader info, as it looks like what you want?
 
Here is another example (FunnyChar2 attached) and I've included the entire code this time associated with this. The code that produces the line in question is at the end

Code:
Forms!ChartPrescription!nNote = "Rx CALLED:  " & Ph6 & " - " & PTF

and seems to be 'Ph6' after I isolated it from everything else.

Code:
Public Sub PrescriptionLoad()
Dim fPre As Form
On Error GoTo PL_Err
    DoCmd.OpenForm "ChartPrescription", , , , acFormAdd
    Set fPre = Forms!ChartPrescription
 
    fPre.Rx1 = DLookup("Rx1", "CHANNotesTblRxFrequent")
    fPre.Rx2 = DLookup("Rx2", "CHANNotesTblRxFrequent")
    fPre.Rx3 = DLookup("Rx3", "CHANNotesTblRxFrequent")
    fPre.Rx4 = DLookup("Rx4", "CHANNotesTblRxFrequent")
    fPre.Rx5 = DLookup("Rx5", "CHANNotesTblRxFrequent")
    fPre.Rx6 = DLookup("Rx6", "CHANNotesTblRxFrequent")
    fPre.Rx7 = DLookup("Rx7", "CHANNotesTblRxFrequent")
    fPre.Rx8 = DLookup("Rx8", "CHANNotesTblRxFrequent")
    fPre.Rx9 = DLookup("Rx9", "CHANNotesTblRxFrequent")
    fPre.Rx10 = DLookup("Rx10", "CHANNotesTblRxFrequent")
 
    '_____________________________________________________
 
    Forms!ChartPrescription.nPName = Forms!ChartMain.PName
    Forms!ChartPrescription.nPTel = Forms!ChartMain.nPTel
    Forms!ChartPrescription.nPID = Forms!ChartMain.nPID
    Forms!ChartPrescription.nType = "ATx"
    Forms!ChartPrescription.nDate = Date
    Forms!ChartPrescription.DOB = Forms!ChartMain.nDOB
    Forms!ChartPrescription.Allergy = Forms!ChartMain.Allergy
    Forms!ChartPrescription.RxComments = Forms!ChartMain!RxComments
    Forms!ChartPrescription.PharmTel = Forms!ChartMain!RxComments
 
    '  Create Pharmacy Location String Strip off Telephone and message
 
    Dim P As String
    Dim strCount As Integer
    Dim PFinal As String
 
 
    P = Forms!ChartMain!Pharm
    strCount = InStr(1, P, Chr(13) & Chr(10))
    PFinal = Left(P, strCount - 1)
    '________________________________________________________
    ' -------Separate out Pharm Telephone from ChartMain!Pharm
 
    Dim c As Integer    ' there are 2 vbcrlf's in Pharm to get to Pharm Tel     T1
    Dim c1 As Integer   ' counter for second vbCrLF (Chr(13) and Chr(10)        T2
    Dim r As String     ' all of Pharm string                                   TestStr
    Dim R1 As String    ' Length of Pharm String                                T3
    Dim R2 As String    ' PharmTel stripped out.                                T4
    Dim Ph As String
    Dim Ph1 As String
    Dim Ph2 As String   'Pharm Name
    Dim Ph3 As String
    Dim Ph4 As String
    Dim Ph5 As String   'PharmTel and Comments
    Dim Ph6 As String
    Dim PT As String
    Dim PTF As String
    Dim marker As String
    Dim marker1 As String
 
 
    Ph = [Forms]![ChartMain]![Pharm]           ' this strips out Phone# from Pharmacy info.
    Ph1 = InStr(1, [Ph], Chr(13) & Chr(10))
    Ph2 = Left([Ph], [Ph1] - 1)                 ' Pharmacy Name
 
 
 
    r = Forms!ChartMain!Pharm
    marker = Chr(13) & Chr(10)
 
    c = InStr(1, r, marker)             'count to first Linefeed
    If c > 0 Then
        c1 = InStr(c + 1, r, marker)   'count to second Linefeed
        Ph3 = c1                        'count to Final Pharm Name only  stripped out.
    End If
    R1 = Len(r)                         'Length of Original Pharm Name on ChartMain
        Ph4 = R1                        'test field
    R2 = Right(r, R1 - c1 - 1)
        Ph5 = R2                        'test field
 
    Ph6 = Mid(Ph, Ph1 + 1, c1 - c)
 
    fPre.Pharm = Ph2 & " - " & Ph6
    fPre.PharmTel = R2
 
    '    From PharmTel break down string to only telephone number
 
 
    marker = "Chr(13) & Chr(10)"
    marker1 = "//"
 
    PT = Forms!ChartPrescription!PharmTel
    strCount = InStr(1, PT, marker1)
    If strCount > 0 Then
        strCount = InStr(1, PT, marker1)
    End If
    PTF = Left(PT, strCount - 1)
 
 
    'Forms!ChartPrescription!nNote = "Rx CALLED:  " & PFinal & " - " & PTF   'RX Called: Pharm (w/o City/Street) - PharmTel
    Forms!ChartPrescription!nNote = "Rx CALLED:  " & Ph6 & " - " & PTF
    DoCmd.GoToControl "aa"
 
 
PL_Exit:
    Exit Sub
 
PL_Err:
    DoCmd.Close acForm, "ChartPrescription"
    MsgBox "Please check or update Pharmacy."
    Resume PL_Exit
End Sub

Thanks for all your input.
 

Attachments

  • FunnyChar2.JPG
    FunnyChar2.JPG
    11.6 KB · Views: 105
what are Ph6 and PTF?

i must say, though, this is rather an intruiging mystery!
 
I've worked on it more and it seems to be associated with the Line Feeds, vbCrLfs. But I don't feel comfortable saying that the line feeds are the problems in every case.

Thanks for helping me mull this one over.
 
do you have any other keyboard languages installed on your computer? e.g., i have english (obviously), polish (i'm polish and often use special polish characters when writing emails to family) and greek (for those alpha and beta etc symbols that i need for working in our lab) installed on my computer.

other people in our lab have chinese installed (and default, i think?) b/c they are chinese students and their computers are setup for them to be able to use them easier.

maybe it's a 'non-english' issue?

it looks as though you have pretty sensitive data in your DB - are you able to sanitize this in any way and post a dumbed-down version? i can see if the issue still happens on my system.
 
i just thought of something - if you are trying to pass a string within a string, there'll be funky apsotrophe combinations to make this work properly... try this:

Code:
fIP.Note = "[COLOR=Red]'[/COLOR]" & fIP.PreNote & "[COLOR=Red]'[/COLOR] #[COLOR=Red]'[/COLOR]" & fIP.tempSite & [COLOR=Red]"' '" & [/COLOR]fIP.PostNote &[COLOR=Red] "', '" &[/COLOR] fIP.tempImplant[COLOR=DarkRed] & "'"[/COLOR]
 
Last edited:
That's a great suggestion. I found a work around and I'm afraid to put it back so I can test your thoughts. Next time I start having this problem, I'll remember your ideas. Thanks so much.
 
That's a great suggestion. I found a work around and I'm afraid to put it back so I can test your thoughts. Next time I start having this problem, I'll remember your ideas. Thanks so much.

oh, what was your workaround? i'm interested to know!
 
The funny character actually represented an extra space for some reason. So I actually subtracted or added an extra space/postion with I did my InStr() and Mid() calculations. And this seemed to work.
 

Users who are viewing this thread

Back
Top Bottom