Runtime error '3077': , single & double quote

  • Thread starter Dewan Choudhury via AccessMonster.com
  • Start date
D

Dewan Choudhury via AccessMonster.com

Thanks for the code that helps when it happens to have a single quote on the string, but I am encountering different scenario.

I have sometimes single quote and somtimes double quote string,

The following code works fine if there's a single quote but I need help if I have double quotes also, which means a string on a 2nd seperate instance may have "" quotes.


Private Sub Combo84_AfterUpdate()
Dim rs As Object
Dim strIx

strIx = Me![Combo84]
Set rs = Me.Recordset.Clone
rs.FindFirst "[Issue] = " & Chr$(34) & strIx & Chr$(34)
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

Please help!!!
Best regards,
Dewan
 
K

Ken Snell [MVP]

Use the Replace function to double up the " characters:

rs.FindFirst "[Issue] = " & Chr$(34) & Replace(strIx, Chr(34), Chr(34) &
Chr(34), 1, -1, vbTextCompare) & Chr$(34)
--

Ken Snell
<MS ACCESS MVP>

Dewan Choudhury via AccessMonster.com said:
Thanks for the code that helps when it happens to have a single quote on
the string, but I am encountering different scenario.
I have sometimes single quote and somtimes double quote string,

The following code works fine if there's a single quote but I need help if
I have double quotes also, which means a string on a 2nd seperate instance
may have "" quotes.
Private Sub Combo84_AfterUpdate()
Dim rs As Object
Dim strIx

strIx = Me![Combo84]
Set rs = Me.Recordset.Clone
rs.FindFirst "[Issue] = " & Chr$(34) & strIx & Chr$(34)
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

Please help!!!
Best regards,
Dewan
 

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