I have never seen this error message before???

Sam Summers

Registered User.
Local time
Today, 23:55
Joined
Sep 17, 2001
Messages
939
Hi Guys,

I am getting this weird error message that I have never seen before and don't even know how the strange first character is created?

Looks like a Microsoft bug?

Any ideas?

Thank you in advance if you know what it is.
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    3.4 KB · Views: 133
Never saw it either and can't google it! What is popping the error message? Does 'Hatch Drops' have a special meaning in your app?

Linq ;0)>
 
access builds it's messages up from smaller elements. The error messages are often hard to understand.

do you know what is not working?

it may be a query failing, or a function being called with a bad or missing argument. The easiest way is to use a breakpoint, and step through your code.

You might also need some more robust error handling to recover from this sort of thing.
 
Thanks for replying guys,

Having a nightmare day!

'Hatch DROPS' is the database name that's all.

I don't know enough to use breakpoints although i'm sure I could find it on YouTube?

The error happens when I use a button to open a form?

I have checked the data source and any associated code and queries but nothing?

I also ran the analyser.

Don't know what to do?
 
What is the code attached to the button?
 
Code:
Private Sub TOEnterByAreaBtn_Click()
On Error GoTo TOEnterByAreaBtn_Click_Err

    Dim stDocName As String
    Dim stLinkCriteria As String
    
    ClientName.SetFocus
        If IsNull(SelectArea) Then
        DoCmd.Beep
        MsgBox "You must select an Area first.", vbExclamation, "No Area selected!"
        End
    End If

    SetClient.SetFocus
    If Forms!Main!SetClient.Value = "Transocean" Then
    stLinkCriteria = "[SetArea]=" & Me![SelectArea] & [ReportNumber] = " & Me![ReportNo]"
    DoCmd.OpenForm "EnterItemTransocean", , , stLinkCriteria
    Else
    stDocName = "EnterItemDROPS"
    stLinkCriteria = "[SetArea]=" & Me![SelectArea] & [ReportNumber] = " & Me![ReportNo]"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

TOEnterByAreaBtn_Click_Exit:
    Exit Sub

TOEnterByAreaBtn_Click_Err:
    MsgBox Error$
    Resume TOEnterByAreaBtn_Click_Exit
    
End Sub
 
Comment out your error handling then it should give you an option to debug which will highlight the error. I suspect that

ClientName.SetFocus will be a good candidate probably followed closely by
SetClient.SetFocus

But I may be wrong...
 
inspect your strLinkCriteria, missing double quotes there:

stLinkCriteria = "[SetArea]=" & Me![SelectArea] & [ReportNumber] = " & Me![ReportNo]"

should be:

stLinkCriteria = "[SetArea]=" & Me![SelectArea] & " And [ReportNumber] = " & Me![ReportNo]
 
Thank you to everyone for replying!

That line of code was the issue but now I am getting a new error message from the On Load Event of the form I am opening?

I must have myself in a right mess with my code?
 

Attachments

  • Error Screenshot.png
    Error Screenshot.png
    5 KB · Views: 100
  • Code Screenshot.png
    Code Screenshot.png
    12.8 KB · Views: 96
You are in a bit of a mess here ;
Firstly - You don't need to set focus on a control to set a value on it, so you can lose half the code straight away.
Secondly - Lose all those .Value statements from the end of your control lines - they are unnecessary and make the code harder to read. Value is the assumed property in Access VBA for most controls.
Finally - this is a guess but are you opening this form with where criteria or to a new record?
 
are you updating the value of current record, or you need to put this in new record?

if new record, you must issue first:

docmd.GoToRecord,,acNewRec

before setting the value.
 
As to the original error message, Arnel pointed out the syntax error, but I'll explain the error for your future reference.

When you see the error referencing what SHOULD be a field name but it says '|1' instead, it is because you gave it something that didn't resolve to a string in what should have been a string-oriented query element. The effect of leaving out that extra quoting character that Arnel pointed out to you was to concatenate the fields in an "ugly" way:

Me![SelectArea] & [ReportNumber]

Me![SelectArea] might have been text, but from the context, [ReportNumber] is a binary number. The odds are that you appended a weird sequence of characters in which each 8 bytes of the [ReportNumber] field was treated as a character. For low numbers, that would have appended two or three nulls as part of the text string. In essence, this confuses the heck out of the parser and you get that nonsense message because the parser attempted to interpret the string and couldn't. There are cases where Access really doesn't like nulls and this is one of them.

One could argue that this is a bug in the SQL parser, in that when it sees a nonsense string like that, it should modify its error message to explain the situation better. But then again, it has been reported this ugly way for years and some things just don't change after the concrete is dry, if you know what I mean.
 
Such brilliant advice guys - Thank you SO much!

I am learning but slowly.

Report number is for example - HE-168-DIA-DR-003

I am entering new details that are part of the above report.

Hope that helps?

I will post the final code when I get it working from all your advice
 
After further testing, it isn't even required that you concatenate binary and text. Just name a field that doesn't exist at all. You'll STILL get the error you saw with the "|1" rather than the name you named incorrectly.
 
What I'm saying in the second post is that if you just spell the field name wrong in a query, that would be enough to give that error you didn't recognize with the "|1" rather than a "real" field name. This is a case where the Access error handler is dumber than a box of rocks.
 

Users who are viewing this thread

Back
Top Bottom