15776 Using a variable in a "DoCmd" VBA argument
Sign Up |  Live StatsLive Stats    Articles 37,335| Comments 177,297| Members 19,418, Newest Ssimran| Online 551
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags
Sikh Philosophy Network » Sikh Philosophy Network » Current News » Information Technology » Using a variable in a "DoCmd" VBA argument

Using a variable in a "DoCmd" VBA argument

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
VBA Access - Moving parts of a program to DLLs? Error 91.. "Object variable or With block variable not set" axs221 Information Technology 10 28-Jul-2006 08:41 AM
" Invalid Argument" error (# 3001) - Conversion Access 97 to 2002 fred_y_Ohio Information Technology 2 28-Jul-2006 08:27 AM
DoCmd.RunSql "Select * from abc" Mohammed Information Technology 5 28-Jul-2006 08:18 AM
"Out of Memory" when trying to output record on one specific variable bradjensmith@gmail.com Information Technology 0 28-Jul-2006 08:16 AM
help with docmd, "Form" gurumum@email.uc.edu Information Technology 2 11-Nov-2005 20:09 PM


Tags
argument, docmd, quotdocmdquot, using, variable, vba
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 28-Jul-2006, 08:09 AM
George Walsh's Avatar George Walsh
Guest
 
Posts: n/a
   
   
Using a variable in a "DoCmd" VBA argument

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
I have written an event procedure to run when a user clicks a command button
in a form. The button press is supposed to engage the action to make a copy
of a specified table.
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/10044-using-a-variable-docmd-vba-argument.html

The form exposes a list box showing all the table names in the current
database to the user, and it allows the user to specify both the present
name of the table to be copied and the new name of the copied table.

The event procedure in VBA declares two variant variables and performs the
DLookup function to obtain the specified names. This part is tested and
works.

I next want to evoke the DoCmd.CopyObject function which includes the names
of the "DestinationDatabase" and "NewName" as arguments; however, I don't
know how to make the call work unless I actually type the table names
enclosed by quotation marks.

For example: this works ...
DoCmd.CopyObject "ClientSourceData", "ClientSourceData_12-31-1999",
acTable, "ClientSourceData"

Is there any way to get the DoCmd to accept the table names by passing the
table names from the user-selected variables rather than by typing literal
names in quotes in the DoCmd call?

Or, is there another way to accomplish what I am trying to do? I can't find
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10044
a solution and would appreciate some suggestions. Thanks.




Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 28-Jul-2006, 08:09 AM
Allen Browne's Avatar Allen Browne
Guest
 
Posts: n/a
   
   
Re: Using a variable in a "DoCmd" VBA argument

If you have the names in controls on the form, you can refer directly to
those instead of the literals in quotes.

For example if you have text boxes named Text1, Text2, and Text3:
DoCmd.CopyObject Me.Text1, Me.Text2, acTable, Me.Text3

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"George Walsh" wrote in message
news:0T_bg.3730$9W5.461@tornado.socal.rr.com...
>I have written an event procedure to run when a user clicks a command
>button in a form. The button press is supposed to engage the action to
>make a copy of a specified table.
>
> The form exposes a list box showing all the table names in the current
> database to the user, and it allows the user to specify both the present
> name of the table to be copied and the new name of the copied table.
>
> The event procedure in VBA declares two variant variables and performs the
> DLookup function to obtain the specified names. This part is tested and
> works.
>
> I next want to evoke the DoCmd.CopyObject function which includes the
> names of the "DestinationDatabase" and "NewName" as arguments; however, I
> don't know how to make the call work unless I actually type the table
> names enclosed by quotation marks.
>
> For example: this works ...
> DoCmd.CopyObject "ClientSourceData", "ClientSourceData_12-31-1999",
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10044
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10044
> acTable, "ClientSourceData"
>
> Is there any way to get the DoCmd to accept the table names by passing the
> table names from the user-selected variables rather than by typing literal
> names in quotes in the DoCmd call?
>
> Or, is there another way to accomplish what I am trying to do? I can't
> find a solution and would appreciate some suggestions. Thanks.
>
>



Reply With Quote
  #3 (permalink)  
Old 28-Jul-2006, 08:09 AM
George Walsh's Avatar George Walsh
Guest
 
Posts: n/a
   
   
Re: Using a variable in a "DoCmd" VBA argument

  Donate Today!  
Thanks very much! That works.


"Allen Browne" wrote in message
news:%23ncvwUOfGHA.3364@TK2MSFTNGP05.phx.gbl...
> If you have the names in controls on the form, you can refer directly to
> those instead of the literals in quotes.
>
> For example if you have text boxes named Text1, Text2, and Text3:
> DoCmd.CopyObject Me.Text1, Me.Text2, acTable, Me.Text3
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "George Walsh" wrote in message
> news:0T_bg.3730$9W5.461@tornado.socal.rr.com...
>>I have written an event procedure to run when a user clicks a command
>>button in a form. The button press is supposed to engage the action to
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10044
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=10044
>>make a copy of a specified table.
>>
>> The form exposes a list box showing all the table names in the current
>> database to the user, and it allows the user to specify both the present
>> name of the table to be copied and the new name of the copied table.
>>
>> The event procedure in VBA declares two variant variables and performs
>> the DLookup function to obtain the specified names. This part is tested
>> and works.
>>
>> I next want to evoke the DoCmd.CopyObject function which includes the
>> names of the "DestinationDatabase" and "NewName" as arguments; however, I
>> don't know how to make the call work unless I actually type the table
>> names enclosed by quotation marks.
>>
>> For example: this works ...
>> DoCmd.CopyObject "ClientSourceData", "ClientSourceData_12-31-1999",
>> acTable, "ClientSourceData"
>>
>> Is there any way to get the DoCmd to accept the table names by passing
>> the table names from the user-selected variables rather than by typing
>> literal names in quotes in the DoCmd call?
>>
>> Or, is there another way to accomplish what I am trying to do? I can't
>> find a solution and would appreciate some suggestions. Thanks.
>>
>>

>
>



Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
Request for assistance...
Today 09:34 AM
10 Replies, 115 Views
Occultism - Rejection in...
Today 08:44 AM
62 Replies, 2,628 Views
‘Bigoted’ Facebook...
Today 08:32 AM
1 Replies, 27 Views
Australia mulls allowing...
Today 07:30 AM
0 Replies, 19 Views
Woolwich Killing: The...
Today 06:41 AM
3 Replies, 67 Views
Panjabi
By Ishna
Today 04:40 AM
16 Replies, 312 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 03:09 AM
316 Replies, 7,639 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 03:00 AM
179 Replies, 4,539 Views
How does Sikhi help you...
Today 00:52 AM
31 Replies, 982 Views
Transgenderism ... Right...
By Kaylee
Today 00:33 AM
25 Replies, 1,265 Views
Losing My Religion: Why...
Today 00:00 AM
14 Replies, 392 Views
Kirtan
Yesterday 21:24 PM
0 Replies, 37 Views
Keeping Amrit Vela
Yesterday 16:49 PM
12 Replies, 937 Views
Do you believe in...
Yesterday 15:08 PM
196 Replies, 4,107 Views
Black Sikhs?
Yesterday 06:33 AM
20 Replies, 5,910 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 09:45 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.38494 seconds with 32 queries
0