Remou:
You are correct. I ran the code with the specific example I posted and it worked perfectly. The problem with my SQL statement was along the lines:
INSERT INTO tblA SELECT * FROM [qryA];
The SQL statement worked with RunSQL, but with a QueryDef it did not like that the data behind FROM...
Thanks for the replies.
Remou:
I haven't used DAO before so this idea never occurred to me. Since I have a dynamic SQL query that is run hundreds of times I decided to try a temporary QueryDef using the following instead but am having a problem -
dim qdf as DAO.QueryDef
dim strSQL as String...
Is there any way to determine the number of rows that are about to be appended to a table using an insert query through DoCmd.RunSQL [query] ?
If I don't turn warnings off, Access will visually display how many rows are about to be appended, but is there any way to access this in the code...
dRahme
Thanks for the help. I use something very similar for all of my other projects, it is just that I am required to use the built-in Access security for this one and was trying to figure out why I should have to write my own routines to do this kind of thing when I am already using...
grnzbra,
According to Access help, "You should use the smallest possible FieldSize property setting because smaller data sizes can be processed faster and require less memory."
Although I too am not sure how memory size is actually managed internally with Access, this property has the added...
I have created a database using Access Security. I would like to know what would be the best way to disable options on the main menu form, ie. the Switchboard, that a user does not have access to as opposed to program using a popup to inform the user that they do not have permission to view a...
With my problem it simply had to do with the default printer I had chosen in windows. Start -> Settings -> Printers, and then I changed my default printer to a new one. This fixed the problem.
I have no idea as to why the printer matters when attempting to view the code behind a form, but it...
I have noticed a few problems with the Filter function and the way you are attempting to use it. First, Filter wants to return a string array and will not allow you to return to a variant array, but it also wants a non-dim array. If you create an array of a certain size:
Dim astrArray(5) as...
Just recently I ran into this same error. The problem was with the default printer that I had selected. My default printer was have updates installed and this happened to cause a lot of Office issues that wouldn't seem like the default printer would matter. This caused me to get a C++ runtime...
I ran your code and it finds all of the tables I have constructed so I cannot figure out why it would return one table twice. From what I see, ShowFields() is supposed to append all of the field names in the statement, but I do not see where you append the "Create table" & tablename part in your...
The following would work for negatives in the Ceiling function:
Function Ceiling(ByVal iOne As Double, ByVal iTwo As Double)
On Error GoTo HandleErrors
Ceiling = Excel.WorksheetFunction.Ceiling(iOne, iTwo)
ExitClean:
Exit Function
HandleErrors:
Select Case Err.Number
'...
Well in that case you may want something more along the lines of:
Function chkdate()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim blnEndLoop As Boolean
blnEndLoop = False
strSQL = "SELECT DateChk FROM tblDateCheck;"
Set dbs =...
I am not exactly sure what everything in your code is attempting to accomplish. I am guessing that this code is supposed to loop contiuously until the date has changed (possibly for four hours) and then execute a new job when the date has changed.
A few things I noticed:
- Your variable...
Why can't you just use:
Shell(strPathName, vbNormalFocus)
where strPathName is your variable holding the path?
If you set up a function in a module to do this for you it seems as though you would just be making a new way to call Shell using basically the same arguments.
Tom
I've had this problem quite a while ago and remember clearing it up using the Logon method of the NameSpace object. I can't remember exactly the parameters I used for the Logon method but you might try adding the blue into your code:
Dim objOutlook As Outlook.Application
Dim objNameSpace as...
Your code may not be giving the form enough time to load all of the filtered records. Try adding:
Me.RecordsetClone.MoveLast
Before using:
Me.RecordsetClone.RecordCount
This will ensure that all records have been accounted for before displaying a count.
Hope this helps,
Tom
Sorry, I've been on vacation for a few days. What I've noticed from your code that you originally posted with the error after importing the first file is that this line:
DoCmd.TransferSpreadsheet acImport, 8, "TBL_DEC", objFile.Name, True
Should be this:
DoCmd.TransferSpreadsheet acImport, 8...
This code goes inside of MS Access. Excel is not used at all. ADO and DAO are not necessary because "DoCmd.TransferSpreadsheet" does all of the work putting the information into the tables.
You can run this code anyway you like in Access. For instance, you could create a form and put this code...
I understand your idea, but that doesn't seem to be the case here. I have created linked lists before in VBA with no issues. In fact, this one works quite well aside from not being able to Hook into events. If I change the code:
Private WithEvents mobjNext as cListItem
to:
Private mobjNext as...
This can be easily done. To get all of the files in a folder you could use something such as:
Dim objFSO as Object
Dim objFile as Object
Dim strPath as String
dim strFilePath as String
strPath = "C:\Workbooks"
Set objFSO = CreateObject("Scripting.FileSystemObject")
For Each objFile in...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.