Error 3077

J

JMorrell

I get the "missing operator" syntax error 3077 in the following code for
some records, but not all records in a list box.

Private Sub List11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[NameOfPublication] = '" & Me![List11] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Is it a data issue or something else?

tia,
 
J

JMorrell

It is possible that some fields in the records are null. However, the
records where the error comes up are really no different than other records -
as far as I can see. The table is an import from excel, all imported cells
were text, PK is created by the import process.

What am I missing here?
JMorrell


Dave M said:
Is it possible for the bound column in List11 to be Null?

JMorrell said:
I get the "missing operator" syntax error 3077 in the following code for
some records, but not all records in a list box.

Private Sub List11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[NameOfPublication] = '" & Me![List11] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Is it a data issue or something else?

tia,
 
J

JMorrell

Looking further into the data, I noticed that the records where the error
occurs all have an apostrophe somewhere in the text.

Simple enough to find, how to fix? I always have problems with the quote,
apostrophe, quote, apostrophe... ad nauseam.

What is the correct syntax for this?

Thanks a ton,
JMorrell

Dave M said:
Is it possible for the bound column in List11 to be Null?

JMorrell said:
I get the "missing operator" syntax error 3077 in the following code for
some records, but not all records in a list box.

Private Sub List11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[NameOfPublication] = '" & Me![List11] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Is it a data issue or something else?

tia,
 
D

Douglas J. Steele

Try

rs.FindFirst "[NameOfPublication] = " & Chr$(34) & Me![List11] & Chr$(34)

or (assuming you're using Access 2000 or newer)

rs.FindFirst "[NameOfPublication] = '" & Replace(Me![List11], "'", "''") &
"'"

Exagerated for clarity, that second one's

rs.FindFirst "[NameOfPublication] = ' " & Replace(Me![List11], " ' ", " ' '
") & " ' "

Note that the first one will fail if Me![List11] contains double quotes in
it...

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


JMorrell said:
Looking further into the data, I noticed that the records where the error
occurs all have an apostrophe somewhere in the text.

Simple enough to find, how to fix? I always have problems with the quote,
apostrophe, quote, apostrophe... ad nauseam.

What is the correct syntax for this?

Thanks a ton,
JMorrell

Dave M said:
Is it possible for the bound column in List11 to be Null?

JMorrell said:
I get the "missing operator" syntax error 3077 in the following code for
some records, but not all records in a list box.

Private Sub List11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[NameOfPublication] = '" & Me![List11] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Is it a data issue or something else?

tia,
 
J

JMorrell

That did the trick. Thank you!

Is there a place that explains the proper use of the double and single quote?

JMorrell

Douglas J. Steele said:
Try

rs.FindFirst "[NameOfPublication] = " & Chr$(34) & Me![List11] & Chr$(34)

or (assuming you're using Access 2000 or newer)

rs.FindFirst "[NameOfPublication] = '" & Replace(Me![List11], "'", "''") &
"'"

Exagerated for clarity, that second one's

rs.FindFirst "[NameOfPublication] = ' " & Replace(Me![List11], " ' ", " ' '
") & " ' "

Note that the first one will fail if Me![List11] contains double quotes in
it...

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


JMorrell said:
Looking further into the data, I noticed that the records where the error
occurs all have an apostrophe somewhere in the text.

Simple enough to find, how to fix? I always have problems with the quote,
apostrophe, quote, apostrophe... ad nauseam.

What is the correct syntax for this?

Thanks a ton,
JMorrell

Dave M said:
Is it possible for the bound column in List11 to be Null?


I get the "missing operator" syntax error 3077 in the following code for
some records, but not all records in a list box.

Private Sub List11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[NameOfPublication] = '" & Me![List11] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Is it a data issue or something else?

tia,
 
D

Douglas J. Steele

See whether my May, 2004 Access Answer column in Pinnacle Publication's
Smart Access helps.

You can get a copy of the article (and its accompanying download file) at
http://members.rogers.com/douglas.j.steele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



JMorrell said:
That did the trick. Thank you!

Is there a place that explains the proper use of the double and single quote?

JMorrell

Douglas J. Steele said:
Try

rs.FindFirst "[NameOfPublication] = " & Chr$(34) & Me![List11] & Chr$(34)

or (assuming you're using Access 2000 or newer)

rs.FindFirst "[NameOfPublication] = '" & Replace(Me![List11], "'", "''") &
"'"

Exagerated for clarity, that second one's

rs.FindFirst "[NameOfPublication] = ' " & Replace(Me![List11], " ' ", " ' '
") & " ' "

Note that the first one will fail if Me![List11] contains double quotes in
it...

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


JMorrell said:
Looking further into the data, I noticed that the records where the error
occurs all have an apostrophe somewhere in the text.

Simple enough to find, how to fix? I always have problems with the quote,
apostrophe, quote, apostrophe... ad nauseam.

What is the correct syntax for this?

Thanks a ton,
JMorrell

:

Is it possible for the bound column in List11 to be Null?


I get the "missing operator" syntax error 3077 in the following
code
for
some records, but not all records in a list box.

Private Sub List11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[NameOfPublication] = '" & Me![List11] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Is it a data issue or something else?

tia,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top