Macro Running Module Failure
Nov 15, 2006
hey there,
i have a macro that has 2 actions:
set warnings to warning on: NO
and
runCode to Function Name: cmdImport_Click()
where cmdImport_Click() is a Private Sub in a module within the same database.
when i try to run the macro i get an error that stated
"the expression you entered has a function name that MS Access can't find."
but if i open the module called ImportMSExcelFile and set my cursor on the Private Sub cmdImport_Click() and select the green arrow to run the procedure it runs fine.
any suggetions?
tuktuk
View Replies
ADVERTISEMENT
Aug 30, 2005
Hi guys.
I got a problem with my access database. I'm using the code as below in a access function.
Code:Dim rst As ADODB.RecordsetSet rst = New ADODB.RecordsetstrSQL = "select * from tbl1 where fldDate between #08/22/2005# and #08/28/2005#" rst.Open strSQL, CurrentProject.Connection, adOpenStatic
When I get to the last line, It will cause a "catastrophic failure" on my computer, whilst on others it will run just nicely.
I'm thinking some sort of version problem, but wouldn't know where to look...
..help..
View 1 Replies
View Related
Aug 2, 2007
How to run a module in the macro?
Which step can run a module.
There is only option to openmodule action.
Please clarify
View 1 Replies
View Related
Mar 26, 2006
I get a syntax error when I run this query from an Access Module but I don't get an error when I run it as a straight query. Can anyone see what's wrong with it? I am using Access 2003
Dim sqlStmt As String
sqlStmt = "SELECT [CCC Companies].ESTBLMT_NO, SUM(subWeight) AS weight "
sqlStmt = sqlStmt + "FROM [CCC Companies], [SELECT ESTBLMT_NO, COUNT(*) * 10 AS subWeight "
sqlStmt = sqlStmt + "FROM CCCWords "
sqlStmt = sqlStmt + "WHERE Word IN ( Select word from CBCWords where vendor = '"
sqlStmt = sqlStmt + strVendor
sqlStmt = sqlStmt + "') GROUP BY ESTBLMT_NO "
sqlStmt = sqlStmt + "UNION "
sqlStmt = sqlStmt + "SELECT ESTBLMT_NO,COUNT(*) * 25 AS subWeight "
sqlStmt = sqlStmt + "FROM CCCCleansedPhone "
sqlStmt = sqlStmt + "WHERE MID(STRIPPED_PHONE,1, 5) IN ( Select MID(STRIPPED_PHONE,1 ,5) FROM CBCCleansedPhone WHERE vendor_no = '"
sqlStmt = sqlStmt + strVendor
sqlStmt = sqlStmt + "') GROUP BY ESTBLMT_NO "
sqlStmt = sqlStmt + "UNION "
sqlStmt = sqlStmt + "SELECT ESTBLMT_NO, COUNT(*) * 50 AS subWeight "
sqlStmt = sqlStmt + "FROM CCCCleansedPhone "
sqlStmt = sqlStmt + "WHERE MID(STRIPPED_PHONE,1, 7) IN ( Select MID(STRIPPED_PHONE,1 ,7) FROM CBCCleansedPhone WHERE vendor_no = '"
sqlStmt = sqlStmt + strVendor
sqlStmt = sqlStmt + "') GROUP BY ESTBLMT_NO "
sqlStmt = sqlStmt + "UNION "
sqlStmt = sqlStmt + "SELECT ESTBLMT_NO, COUNT(*) * 50 AS subWeight "
sqlStmt = sqlStmt + "FROM CCCCleansedPostalCode "
sqlStmt = sqlStmt + "WHERE MID(STRIPPED_POSTAL,1, 6) IN ( Select MID(STRIPPED_POSTAL,1 ,6) FROM CBCCleansedPostalCode WHERE vendor_no = '"
sqlStmt = sqlStmt + strVendor
sqlStmt = sqlStmt + "') GROUP BY ESTBLMT_NO "
sqlStmt = sqlStmt + "]. AS dupWeight "
sqlStmt = sqlStmt + "WHERE dupWeight.ESTBLMT_NO = [CCC Companies].ESTBLMT_NO "
sqlStmt = sqlStmt + "GROUP BY [CCC Companies].ESTBLMT_NO "
sqlStmt = sqlStmt + "HAVING SUM(subWeight) >= 60 "
sqlStmt = sqlStmt + "ORDER BY SUM(subWeight) DESC"
DoCmd.OpenForm "Show Probabilities", , , sqlStmt
Here is the code that runs ok in a straight query:
SELECT [CCC Companies].ESTBLMT_NO, SUM(subWeight) AS weight
FROM [CCC Companies], [SELECT ESTBLMT_NO, COUNT(*) * 10 AS subWeight
FROM CCCWords
WHERE Word IN ( Select word from CBCWords where vendor = '100024')
GROUP BY ESTBLMT_NO
UNION
SELECT ESTBLMT_NO, COUNT(*) * 25 AS subWeight
FROM CCCCleansedPhone
WHERE MID(STRIPPED_PHONE,1, 5) IN ( Select MID(STRIPPED_PHONE,1 ,5) FROM CBCCleansedPhone WHERE vendor_no = '100024')
GROUP BY ESTBLMT_NO
UNION
SELECT ESTBLMT_NO, COUNT(*) * 50 AS subWeight
FROM CCCCleansedPhone
WHERE MID(STRIPPED_PHONE,1, 7) IN ( Select MID(STRIPPED_PHONE,1 ,7) FROM CBCCleansedPhone WHERE vendor_no = '100024')
GROUP BY ESTBLMT_NO
UNION
SELECT ESTBLMT_NO, COUNT(*) * 50 AS subWeight
FROM CCCCleansedPostalCode
WHERE MID(STRIPPED_POSTAL,1, 6) IN ( Select MID(STRIPPED_POSTAL,1 ,6) FROM CBCCleansedPostalCode WHERE vendor_no = '100024')
GROUP BY ESTBLMT_NO
]. AS dupWeight
WHERE dupWeight.ESTBLMT_NO=[CCC Companies].ESTBLMT_NO
GROUP BY [CCC Companies].ESTBLMT_NO
HAVING SUM(subWeight)>=60
ORDER BY SUM(subWeight) DESC;
View 4 Replies
View Related
Sep 14, 2005
Any idea how to retrieve the name of the Module and the name of the Sub/Function that currently executing?
Show me the door... :-)
View 2 Replies
View Related
Dec 7, 2004
I am trying to populate an Excel Shreadsheet (Template in Effect) with Data from Access. This is going ok no problem. Although I need to run an excel macro, which does some formatting to the WorkSheet after each entry in the Access Recordset. I've tried copying the VB over, but getting some errors, and frankly, I think it's easier if I just call the macro itself, rather than try to adapt it for the Access context. Though, I accept it would be a cleaner approach. Can I do this?
View 1 Replies
View Related
Sep 10, 2014
We have been calling a main form to manage yacht races using a hyperlink/macro from a selection form which lists all the yacht races ..The main form was too big to fit on some screens so we changed it to pop up mode to allow it to be resized and use scroll bars. this works well when the form is opened manually and all functions run just fine
the hyperlinik/macro for race selection had originally been set up to call the main form in dialog mode but we have had to change this as it disabled the resizing of the form and the scroll bars..The macro tool doesn't offer pop up mode so i selected window mode = normal and the main form opens with a resizable window and scroll bars but all the functions called from this module now fail (error message = use of null value or similar and all the functions go into debug mode - the server is down and i can't access the system to get the exact details)
If i change the macro in the selection form back to window mode = dialog the functions work but i lose the resizing of the main form and and the scroll bars.
View 1 Replies
View Related
Mar 11, 2008
Hi,
Can I use a macro to run multiple queries in sequence?
I searched on this but did not see anything that indicated how to do this.
Any pointers would be appreciated!
Thanks,
Mark
View 1 Replies
View Related
May 16, 2006
I've got a Macro that runs well over 100 queries as well as sub-macros. I'd like to know what query the Macro is running. My best solution so far was to create a bunch of forms that open and close with the name of each query, but that's kind of sloppy. I don't think I can use the msgbox because it prompts me to press 'OK' to continue. Any thoughts?
View 2 Replies
View Related
Jun 14, 2004
Hi all,
I was hoping that someone could tell me if it is possible to run an Excel macro from an Access database. I am importing 3 Excel worksheets into Access and this macro needs to be run on all 3 evertime that this file is imported by the user (twice a week). If this can be done could someone please tell me how ??
View 14 Replies
View Related
Jan 31, 2014
I have 2 forms and a macro in Form1 which runs throught every record to update the records, however.I would like to run this macro from the main form (Form2)
I have tried
docmd.openform "Form1"
Run Macro
but it doesnt work
View 4 Replies
View Related
Aug 25, 2012
I have a MS Access append query that updates a table from a linked Excel spreadsheet. Im trying to automate the running of the query during the night.
Ive tried a couple of ways to schedule the task with Windows Task Scheduler, although each time, it appears to start the job, but then just hang (task never completes, doesnt run the query or macro and when I log back into Windows, the msaccess.exe process is running).
Methods Ive used are:
- command line with /x macroname
- vbs script which runs the query / macro
Code:
'Read from a Microsoft ACCESS database
Option Explicit
dim oaccess
'execute another Access macro
set oaccess = createobject("access.application")
oaccess.opencurrentdatabase "H:Database.mdb"
oaccess.docmd.setwarnings false
oaccess.DoCmd.RunMacro "Macro1"
oaccess.docmd.setwarnings true
oaccess.closecurrentdatabase
oaccess.quit
set oaccess=nothing
WScript.Quit(0)
- .bat file which just has the command line in it.They all run fine when I am logged in, although it seems to hang when I am logged off the network. I have the correct permissions as Ive scheduled a Excel macro to run and its fine.
View 4 Replies
View Related
Jan 1, 2015
I have 3 different "buttons" on my form that run individual update queries. I know these update queries are running correctly. Decided to make a macro that will allow me to run all these queries by clicking one macro button.
My question is: Is there some way to stop the pop up msg that advises I am about to run an update query and the next pop up msg that informs me of how many rows I am going to update?
These pop up boxes are starting to drive me crazy when I run the macro.
View 5 Replies
View Related
Dec 22, 2014
I can manually stop the AutoExec macro from running by holding down the shift button - how do you do it by VBA? I'm opening the db from Excel, and I don't want the Switchboard to display ...
View 1 Replies
View Related
Dec 14, 2007
I'm wondering how other members here make decisions whether they want to place codes behind form or use a standard module instead.
I understand there is a performance penalty when you add another module (and use it), but am not sure whether one big fat module would be faster than several smaller modules with identical coding.
Furthermore, I know that some members use a hidden form to deal with startup and shutdown processing. Sometimes the processing has nothing to do with forms and would make more sense in a standard module, but since the form is already loaded, does it makes more sense to use the module behind the form than calling a function in a separate standard module to execute the needed code?
So, what do you tend to do in such situation?
View 14 Replies
View Related
Oct 1, 2004
I am creating an form in a database and whenever one of my procedure's run it creates this error message:
The expression ON Load you entered as the event property setting produced the following error:
Member already exists in an object module from which this object module derives.
*The expression may not result in the name of a macro, the name of a user-defined function, or [event Procedure].
*There may have been an error evaluating the function, event, or macro.
An ideas?
View 7 Replies
View Related
Dec 8, 2013
I am trying to write a more complex macro that will start another macro at a preset time, however I am getting stopped at the first hurdle - getting a macro to run another macro.
Here is the code i am using at the moment, all I want to do currently is click the first button, then get the second macro to execute. But no luck, getting error 2157 "cannot find the procedure"
Code:
Private Sub Command3_Click()
MsgBox "1st macro running", vbExclamation, "Note"
Application.Run "teststart1"
' Application.OnTime TimeValue("19:55:00"), "teststart1"
[code]....
View 1 Replies
View Related
Jun 15, 2005
have a DB which is working fine on most PCs (approx 15 users) I do however have a problem sending emails from some machines (using a macro to do the send object as example below) The mail program used is Outlook 2000 / 2003
DoCmd.SendObject acReport, "Returns Notice", "SnapshotFormat(*.snp)", "to a defind list", True, ""
This works fine BUT on most machines but on a couple we get a fail message when attempting to send, this message is unspecific. I cannot find any different settings on the machines in question, the op system is 2000 / XP.
I operate the same program on my PC running XP prof servpk 2 and although 99% of the time the emails go through without issue I do sometimes have the same problem. Re-booting does not resolve it! and I can find no trend as to why I have the problem.
Any thought or advise welcome.
View 2 Replies
View Related
May 2, 2007
Hello again all... Today's problem is as follows.... I have an "after update" combo box that is coded as "CurrentDb.Execute "uno", dbFailOnError". I have an SQL Query named "uno" that is showing the following: "UPDATE [Input] SET [Input].Loc_Lng = [Loc-1L].Combo8, [Input].Loc_ID = "1", [Input].Loc_Desc = "xxxx";" I am trying to have the combo box update the values from the combo box into a blank table. When I try to run this, it comes up with the error: "Too few parameters. Expected 1". Any idea what that means, and then how to fix?
View 2 Replies
View Related
Sep 26, 2007
I'm fairly new to Access, so maybe someone can school me here...
I have a issue tracking database query reporting a serial number in the first column, an open issue date in the second column and close issue date in the third column. There can be several instances of each serial number.
I already figured out how to use DateDiff to get a time to fix column...
I want to have a column reporting the difference between the previous close date to the next open date (grouped by serial number).
Example
S/N Open Date Close Date Time to Fix MTBF
1234 1/10/2007 1/13/2007 3 5
1234 1/1/2007 1/5/2007 4
2222 1/2/2007 1/3/2007 1
View 9 Replies
View Related
Jun 17, 2007
Hi all
I'm stuck on the following SQL statement. It looks OK to me... but there must be something wrong with it because it doesn't execute.
I've tried the runSQL command and I've tried currentproject. connection.execute as well. Both fail to execute... it has to be the SQL string below.
Thanks for any advice.
SQLImportPE = "UPDATE data INNER JOIN data_import ON data.ID = data_import.ID" & _
"SET data.pe1 = data_import.pe1, data.pe2 = data_import.pe2, data.pe3 = data_import.pe3, data.pe4 = data_import.pe4, data.pe5 = data_import.pe5, data.effort_pe = data_import.effort_pe" & _
"WHERE (((data_import.pe1) Is Not Null));"
View 10 Replies
View Related
Sep 19, 2011
When I highlight a combo box, the default hotkeys should be alt+down or f4 to drop the menu down.The issue I'm having is that while alt+down works, f4 does not. I just got a new computer in my office, and f4 worked on the old one.My keyboard does not have a f-lock key on it. That seems to be the internet's general response to my problem, but that doesn't work.
View 2 Replies
View Related
Sep 26, 2005
hi There
I Have A Database Trying To Convert It To MDE I Get The Following Message
--------------------------------------------------------------------------
This error is usually associated with compiling a large database into an MDE file. Due to the method used to compile the database, a considerable number of TableID references are created for each table. The Microsoft Jet database engine version 4.0 can only create a maximum of 2048 open TableIDs at one time. Exporting a database as an MDE potentially can exceed this limit if the database has a large number of objects (table, macro, form, report, etc).
There is no accurate method to estimate the number of TableIDs the Jet database engine uses during the process of compiling a database as an MDE. However, each VBA module and each form uses one TableID, as a result, if the database has 500 forms, and each form's HasModule property is set to Yes, as many as 1,000 TableIDs are used.
Any Help Please
Thank You In Advance
View 6 Replies
View Related
Aug 30, 2012
My Access table has a record which my update query was unable to locate. This issue resolved when I removed the primary key and applied it again.
View 1 Replies
View Related
Oct 9, 2012
I admin an Access 2007 ADP that is distributed to our user base as an ADE. The back end is MSSQL 2005. Recently, we have begun deploying this software to employees in the field who connect to the corporate network via VPN. Because our field employees are sometimes connecting from some seriously flaky Internet connections, we have seen an uptick in Connection Failure errors.
I've been researching ways to detect and reestablish a failed network connection from VBA so that the user doesn't encounter the errors, or the need to close and reopen the application to continue working. This post appears to get me most of the way there, in that it both suggests a way to detect the failure and reestablish a connection on the fly:
[URL] ....
Basically, it suggests replacing the call to CurrentProject.Connection with a call to your own custom function, looking something like this:
Code:
Function fCurrentConnection () As ADODB.Connection
If CurrentProject.Connection.State = 0 Then
CurrentProject.OpenConnection "YourConnectionString"
End If
Set fCurrentConnection = CurrentProject.OpenConnection
End Function
My problem is that I define my connection in the built in server properties of the project. My users connect using Windows NT Integrated security. I don't know what I should put in the "YourConnectionString" area. Is there a way to tell Access to use the stored settings to reconnect, or alternatively, any example string that connects to a server name and database name using Windows NT Integrated security?
View 2 Replies
View Related
Mar 14, 2005
Can anyone tell me how to get a running balance on a report. I know how to create a running total, by setting the "running sum" property of a text box to "Over all".
I can't however see how I can adapt this to give a running balance (as in a bank statement for example). Attempts to do so end up in failure!!
Many thanks in advance.
Peter
View 2 Replies
View Related