I'm using multiple criteria to pull up records in a form. However, whenever the "Retailer" field has a text string with an apostophe in it (example: Fred's Electronics), it errors out "3077". I'm assuming it reads the ' and it cuts the field short. Is there any way to define the value, or write the code to handle this? - rs.FindFirst "[SKU] = '" & Me![SKU] & "' AND [CHANNEL] = '" & Forms!frmSpecialPricing![Retailer] & "'"
7 2978
Try: -
rs.FindFirst "[SKU] = """ & Me![SKU] & """ AND [CHANNEL] = """ & Forms!frmSpecialPricing![Retailer] & """"
-
Now it's runtime error '2186'. Any thoughts?
What about : -
rs.FindFirst "[SKU] = ""Forms!FormName![SKU] & "" AND [CHANNEL] = ""Forms!frmSpecialPricing![Retailer]"""
-
Seems to work. Thank you.
I take that back. It executes the code...no errors, but now the find function no longer works. It won't filter for any criteria.
I think I got it with this: - Dim rs As Object
-
Set rs = Me.Recordset.Clone
-
Dim ChannelAdj As String
-
Dim Channel As String
-
-
Channel = Forms!frmSpecialPricing![Retailer]
-
-
If InStr(1, Channel, "'", vbTextCompare) > 0 Then
-
ChannelAdj = Replace(Channel, "'", "''", , , vbTextCompare)
-
Else:
-
ChannelAdj = Channel
-
End If
-
-
rs.FindFirst "[SKU] = '" & Me![SKU] & "' AND [CHANNEL] = '" & ChannelAdj & "'"
-
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
-
I think I got it with this: - Dim rs As Object
-
Set rs = Me.Recordset.Clone
-
Dim ChannelAdj As String
-
Dim Channel As String
-
-
Channel = Forms!frmSpecialPricing![Retailer]
-
-
If InStr(1, Channel, "'", vbTextCompare) > 0 Then
-
ChannelAdj = Replace(Channel, "'", "''", , , vbTextCompare)
-
Else:
-
ChannelAdj = Channel
-
End If
-
-
rs.FindFirst "[SKU] = '" & Me![SKU] & "' AND [CHANNEL] = '" & ChannelAdj & "'"
-
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
-
Excellent, thanks for posting the solution.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: shank |
last post by:
1) I'm getting this error: Syntax error (missing operator) in query
expression on the below statement. Can I get some advice.
2) I searched ASPFAQ and came up blank. Where can find the "rules"...
|
by: Jennifer |
last post by:
Could you please report the following problem to your VC customer support?
THANKS!
Jennifer
The problem is specific to the VC.Net and VC.Net 2003 <xlocinfo> headers.
The problem is that if...
|
by: Jack |
last post by:
Hi,
I am trying to test a sql statement in Access which gives me
the error as stated in the heading.
The sql statement is built as a part of asp login verification,
where the userid and password...
|
by: DataBard007 |
last post by:
Hello Access Gurus:
I use Win98SE and Access97.
I just built a simple Access97 application which holds all contact
information for my personal contacts, such as first name, last name,
address,...
|
by: Peter Ross |
last post by:
Using V1.1 of the framework, I try and compile the following as a
module.
#using <mscorlib.dll>
__gc public class Test : public System::Object
{
};
$ cl /clr:noAssembly /LD test.cpp...
|
by: PufferFish |
last post by:
Hi folks,
I hope that this is the correct group for these things, apologies if not.
I've got a strange compiler error. It appears to be similar to the issue
described in knowledgebase...
|
by: VancouverMike |
last post by:
Hi there,
I run into a very strange problem. I got the following url and am passing
information via query string. The problem when the "sin" key in query string
is blank, shown as in the...
|
by: Rebecca Smith |
last post by:
Today's problem is - my combo box works great until it comes across a name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very common
problem and I'm sure the work around is very...
|
by: snowdream1982 |
last post by:
Dear all, I hit an error OVERFLOW but when I insert the sql statement below manually in the SQLEditor, it goes well, no errors at all.
My coding:
SQLInsertTempMf = "INSERT INTO tempmf " &...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |