Solved

Error when running a macro to run a module

Posted on 2007-04-10
6
830 Views
Last Modified: 2008-02-01
I am trying to test out my module so I have created a macro to run the module.  The macro calls the function partb_gg however when i run the macro i get an error msg: microsoft access cannot find the name partb_gg you entered into the expression.  I have doubled checked the name of the function on the module and it matches with the name that the macro is calling.
0
Comment
Question by:gupshup
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:jerryb30
Comment Utility
Can you post the module code?
Or do the function and module have the same name?
0
 

Author Comment

by:gupshup
Comment Utility
Below is the module.

Option Compare Database

Function partb_gg()
On Error GoTo Test_Delete_Err_partb

DoCmd.RunSQL "DELETE *  FROM B_Reject_Fact_Monthly where month = [Enter B_Reject Month to Delete:] and year = [Enter B_Reject Year to Delete:]", -1



DoCmd.RunSQL "INSERT INTO B_Reject_Fact_Monthly" & _
" ( prv_id, wk_ending_dt, wk, [month], [year],rej_cd, rej_cd_cnt, reject_total )" & _
" SELECT a.prov_numb, GetWeekEndDate([deny_code]) as WeekEndDate, DatePart('ww',denial_date]) AS wk," & _
" Month([denial_date]) AS [month], Year([denial_date]) AS [year], 'testing' as rej_cd_cnt,'testing' as reject_total" & _
" FROM part_b_rejs AS a WHERE (((Month([WeekEndDate])) = [Enter B_Reject Month to Insert:])" & _
" And ((Year([WeekEndDate])) = [Enter B_Reject Year to Insert:])) Group BY a.prv_id, DatePart('ww',[denial_date])," & _
" Month([denial_date]), Year([denial_date]), GetWeekEndDate([deny_code]), a.rej_cd;"

Test_Delete_partb_Exit:
    Exit Function

Test_Delete_Err_partb:
    MsgBox Error$
    Resume Test_Delete_partb_Exit

End Function
0
 
LVL 26

Accepted Solution

by:
jerryb30 earned 50 total points
Comment Utility
What happens if you run the function while in design view (F5)?
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

Author Comment

by:gupshup
Comment Utility
It asks for a month then a year. when i put in january and 2007 it then says 'datatype mismatch'
0
 

Author Comment

by:gupshup
Comment Utility
I figured it out.  The macro needs () after the function name.
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Yep ....
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now