It's only passing through data that has a single quote in it. If I put
double
quotes in the data then it won't pass the data. How should I do this
now?
Should I double them up again or try something different? Also, should
I
be
putting these double quotes on the line of code that specifies the
[CustPO]
open argument?
:
That should work. However, it sounds as though you have a workaround
by
using single quotes.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
message Hi Doug,
I followed your instructions in your last post and it's working for
single
quotes but not for double quotes. Here's what I changed it to:
DoCmd.OpenForm "frmCorrectiveActionRMA", , , "[RMA#] = " & Chr(34) &
Replace(Me![RMA], Chr(34), Chr(34) & Chr(34)) & Chr(34), , ,
Me![RMA]
Am I doing something else wrong?
Should I also change the code on the line that has the [CustPO]
argument?
:
Whenever you use a particular character (such as ") as a delimiter
in
SQL
and that character appears in the text, you need to double up the
character.
However, you have the option of using a single quote (Chr(39))
rather
than a
double quote (Chr(34)):
DoCmd.OpenForm "frmCorrectiveAction", , , "[RMA#] = " & Chr(39) &
Me![RMA]
& Chr(39), , , Me![RMA]
If CustPO can also have single quotes in it in addition to double
quotes,
you'll have no choice but to go the double-up route. Assuming
you're
using
Access 2000 or newer:
DoCmd.OpenForm "frmCorrectiveAction", , , _
"[RMA#] = " & Chr(34) & _
Replace(Me![RMA], Chr(34), Chr(34) & Chr(34)) & _
Chr(34), , , Me![RMA]
You might take a look at my May, 2004 "Access Answers" column in
Pinnacle
Publication's "Smart Access" where I talk about this. You can
download
the
column (and sample database) for free at
http://www.accessmvp.com/DJSteele/SmartAccess.html
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
in
message Sorry about that. I meant to post the code...
If Len(Me.OpenArgs) > 0 Then
Me![RMA#].DefaultValue = Chr(34) & Me.OpenArgs & Chr(34)
Me![CustPO].DefaultValue = Chr(34) & [Forms]![frmRMA]![CustPO] &
Chr(34)
End If
I have this OpenArg statement on a command button on my "frmRMA":
DoCmd.OpenForm "frmCorrectiveAction", , , "[RMA#] = " & Chr(34) &
Me![RMA]
&
Chr(34), , , Me![RMA]
If there is a " mark in the "CustPO" on my frmRMA then it won't
pass
the
argument.
:
How are you passing the data? Show us the code... <g>
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
"Secret Squirrel" <
[email protected]>
wrote
in
message
I'm using the OpenArgs function to pass data from one form to
another.
The
fields that I'm passing the data to and from are both text
fields.
Why
is
it
that if the field that I'm passing from has a " mark in it
then
it
won't
pass
that field's data? Is there a way to fix this so it will allow
the
data
to
be
passed even if there is a " in the data?