Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 12th, 2005, 12:36 PM
ccool ccool is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 3 ccool User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 24 sec
Reputation Power: 0
Access Macro - Using action runcode

I have a standard module called test with a function called save_report which executes the OutputTo function with the date and time appended to the file name. What I would like to do is have this code executed from a macro using the runcode action. Right now the code in the module looks like this:

Function Save_Report()

Dim tempDate As String
Dim tempTime As String
Dim fileName As String

tempDate = Format(Date, "yymmdd")
tempTime = Format(Time, "hhnn")

fileName = ".\rpts\test_" & tempDate & "-" & tempTime & ".SNP"
DoCmd.OutputTo acOutputReport, "rBarcodeList", acFormatSNP, fileName, False

End Function

I have a macro that has a number of query actions but the last thing I would like to do is run this code to output a report. I have entered the runcode action and entered the function name into the function field using the query build button. However, when the macro is executed the runcode action does not work and the action failed popup appears.

When I try to put a breakpoint in the code of the module and run the form that runs the macro it seem the program nevers seems to go into the module. Could someone shed some light onto why I may be having this problem.

Reply With Quote
  #2  
Old January 12th, 2005, 02:23 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
ccool,

This function is fine. I suspect that your macro has failed prior to running this function and aborted. This is why putting a breakpoint in this function didn't work. I would recheck the other procedures in your macro prior to running this function to find your error.

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Access Macro - Using action runcode


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT