Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2009, 11:54 AM
Registered User
 
Join Date: Jun 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Challenge including the double quotes to use Find Method

Hi

I am using Find Method in Access 2007. Since Find method needs the Column name with double Quotes, Current Challenge am facing is including the double quotes along with the column name
The column name being dynamic taken from variable. Else when hardcoding the column string this works fine.

strColumn = "ContactID="
strValue = 33

Want to achive
rs.Find "ContactID=" 33

I have tried
Opt1. strFind=" " " & strColumn & " " " (the output stored in the strFind variable is not as expected)
Opt2. rs.Find " " " & strColumn & " " " & strValue


Thank you
Regards
Knight
 
Old June 29th, 2009, 04:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

In the case of

strColumn = "ContactID="
intValue = 33

Code:
rs.Find strColumn & intValue
In the case of

strColumn = "ContactID="
strValue = "33"

Code:
rs.Find strColumn & "'" & strValue & "'"
and FYI for

strColumn = "ContactID="
dtmValue = Date()

Code:
rs.Find strColumn & "#" & dtmValue & "#"
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
The Following User Says Thank You to SerranoG For This Useful Post:
knight00779 (July 6th, 2009)
 
Old July 6th, 2009, 05:30 AM
Registered User
 
Join Date: Jun 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Greg,

Thank you for your response. This worked. I was with a misconception to pass " " with the Fieldname. The first option worked.

Rgrds
Knight
 
Old July 7th, 2009, 07:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
Originally Posted by knight00779 View Post
Thank you for your response.
You're quite welcome. Good luck with your project.
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
double quotes MyronCope Classic ASP Basics 2 November 21st, 2006 09:31 AM
displaying single quotes and double quotes ren_123 Classic ASP Databases 2 February 22nd, 2006 02:17 PM
Double Quotes langer123 Classic ASP Basics 2 March 16th, 2005 06:22 PM
parsing with double quotes compcad Beginning VB 6 0 June 30th, 2004 12:48 AM
Double Quotes and Single Quotes Problem phungleon Classic ASP Basics 7 May 27th, 2004 01:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.