Any reason the code you have already needs to be a Sub?  You could simply
change it from Sub to Function and then you can call it from a macro.  If it
must remain a Sub (because lots of other code already calls it), then create
a "wrapper" function:

Public Function CallMySub()
  Call MySub
End Function

.. where "MySub" is the name of your public Sub procedure.

Need more details about the table name and field names and how you want to
fetch a "variable" to do calculations.  What are the calculations?  What are
you doing with the calculated value(s)?

John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of pinar_akturk
Sent: Tuesday, December 20, 2005 7:34 AM
To: [email protected]
Subject: [ms_access] Using Sub Procedure in A Macro

Hello guys,

I hope everyone is OK. I have two questions for you if you can help.

1) I' ve been trying to run some "Sub" procedures in a Macro. I 
searched through the help files, I found out that we can run 
a "function" procedure  with "RunCode" action in a macro. And there 
also it says to run a "Sub" procedure in a macro, call it in a 
function. But I couldn' t figure out how to do that.

2) I want to use the values in a tables (in my database) to use as a 
variable. I have to call these values in the procedure. I figured I 
can do that with "OpenRecordSet", but don' t know how to do it in 
detail. Let say that I put these tables values to a variable called. 
How can I change this variable in a "Do While .... Loop" ? 

I would appreciate any help.
Thanks a lot in advance! ( :
Pýnar








 
Yahoo! Groups Links



 






------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/q7folB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to