|
 |
access thread: run module question
Message #1 by "Z" <zzz8611@y...> on Thu, 15 Feb 2001 21:36:08
|
|
I have a command button that I wish to click to remove single quotes in a
particular field of a table. Someone helped me with the following code,
and I just changed some naming. I know that the InStr syntax is not quite
right here, but I am not sure how to tell it to search this Project Name
field. Can someone help me with the code? Thanks.
Private Sub Command5_Click()
Dim tmpStr As String
Dim SglQuote As Long
SglQuote = InStr(1, "ProjectName", Chr(39), vbTextCompare)
If SglQuote > 0 Then
tmpStr = Left(projectname, SglQuote - 1) & " " & Right(str1, Len
(projectname) - SglQuote)
Else
tmpStr = projectname
End If
RemoveSgl = tmpStr
End Function
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 15 Feb 2001 14:46:54 -0800
|
|
Rather than rolling your own, have a look at this bit from the VB2TheMax
code bank:
http://www.vb2themax.com/Item.asp?PageID=CodeBank&Cat=120&ID=37
(pls watch for line wrapping)
It's a VBA5 version of the Replace() function, which is new in VBA6.
Cheers,
-Roy
-----Original Message-----
From: Z [mailto:zzz8611@y...]
Sent: Thursday, February 15, 2001 1:35 PM
To: Access
Subject: [access] run module question
I have a command button that I wish to click to remove single quotes in a
particular field of a table. Someone helped me with the following code,
and I just changed some naming. I know that the InStr syntax is not quite
right here, but I am not sure how to tell it to search this Project Name
field. Can someone help me with the code? Thanks.
Private Sub Command5_Click()
Dim tmpStr As String
Dim SglQuote As Long
SglQuote = InStr(1, "ProjectName", Chr(39), vbTextCompare)
If SglQuote > 0 Then
tmpStr = Left(projectname, SglQuote - 1) & " " & Right(str1, Len
(projectname) - SglQuote)
Else
tmpStr = projectname
End If
RemoveSgl = tmpStr
End Function
Message #3 by "Z" <zzz8611@y...> on Fri, 16 Feb 2001 08:09:07
|
|
> I have a command button that I wish to click to remove single quotes in
a
> particular field of a table. Someone helped me with the following code,
> and I just changed some naming. I know that the InStr syntax is not
quite
> right here, but I am not sure how to tell it to search this Project Name
> field. Can someone help me with the code? Thanks.
>
>
> Private Sub Command5_Click()
> Dim tmpStr As String
> Dim SglQuote As Long
>
> SglQuote = InStr(1, "ProjectName", Chr(39), vbTextCompare)
> If SglQuote > 0 Then
> tmpStr = Left(projectname, SglQuote - 1) & " " & Right(str1, Len
> (projectname) - SglQuote)
> Else
> tmpStr = projectname
> End If
>
> RemoveSgl = tmpStr
> End Function
>
Thank you Roy. I will look through it. and thank you for letting me know
another help site.
Z
|
|
 |