Wrox Programmer Forums
|
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 July 9th, 2009, 03:50 PM
Registered User
 
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add variables to the DoCMD

I am new to some of VBA. I want to take the following statement and make
PR_WINTER a variable
"N:\ROI_08\Reports\ROILIVE" & Format(Date, "MMDDYY") a variable
DoCmd.TransferSpreadsheet acExport, 8, "PR_WINTER", "N:\ROI_08\Reports\ROILIVE" & Format(Date, "MMDDYY"), True, ""

I can't seem to find this information anywhere in all my books.
Any help would be appreciated.
Thanks
Bill

Last edited by baNTON; July 10th, 2009 at 08:23 AM..
 
Old July 13th, 2009, 04:50 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

To make it a variable, you need to declare a string, assign it and put the string variable in the place of "PR_WINTER". That is...

Dim strSpreadsheet as String

strSpreadsheet = "PR_WINTER"

DoCmd.TransferSpreadsheet acExport, 8, strSpreadsheet, "N:\ROI_08\Reports\ROILIVE" & Format(Date, "MMDDYY"), True, ""
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help regarding DoCmd Pramodhegde Access VBA 1 September 7th, 2007 07:05 AM
add image to report and send with DoCmd.SendObject marcin2k Access VBA 1 February 22nd, 2005 12:48 PM
DoCmd.RunQuery? reindeerw Access VBA 10 April 12th, 2004 04:19 PM
DoCmd.TransferDatabase poonjabba Access VBA 1 August 19th, 2003 07:57 PM
Where is DoCmd object? tonyso C# 0 July 28th, 2003 07:52 AM





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