In the declarations area add the following:
Dim db as Database
Dim rst as Recordset
[/[blue]]
In the body of your code, surround the With... statement with the following:
[blue]
Set db = Currentdb()
Set rst = db.OpenRecordset("<tablename>")
While Not rst.EOF
<this is where your "With"...
pwise,
Thanks, but that doesn't copy the indexes. The tables that I want to copy are heavily indexed.
[shadeshappy] Cruising the Information Superhighway at the speed of light
(your mileage may vary)
PHV,
Thanks for the tip. However, while doing what you say will work, it will bloat my applications database. I'm trying to avoid that.
[shadeshappy] Cruising the Information Superhighway at the speed of light
(your mileage may vary)
I'm trying to find a way, using VBA, to copy a table from one external Access database to another external database. In other words, there are three Access databases involved (source, destination and code).
Most of the copy commands are methods of DoCmd and only work when the database that is...
If I open the query that uses the function and run it, it works just fine. If I use Docmd.OpenQuery it works just fine. If I use DoCmd.RunSQL followed by the SQL code it works fine. Just using it with the .Execute method fails.
I know .Execute has some limitations that the others don't --...
ImHuman,
I said in my post that I copied the function into the new database as well. That's why I'm perplexed. I even checked all VB library references to make sure they were the same.
[shadeshappy] Cruising the Information Superhighway at the speed of light
(your mileage may vary)
I have VB code behind a form that uses the Execute method to run a query:
db.Execute "qryAppendMovement"
Within that query I reference a user-defined function named GTIN2UPC that I wrote.
In one database the code executes perfectly. I put the form, the query and the function into a second...
I have a Windows XP machine with a 70GB hard drive. I'm using only 7 or 8 GB (by adding up the file sizes from a DOS DIR command). However, when I look at the C: drive under "My Computer" it says that almost all 70GB is used!
I've cleaned out the Recycle Bin, deleted the contents of all...
The easiest way to trap the error is to use the Execute method instead of DoCmd:
Dim db as Database
Set db = Currentdb()
On Error GoTo Err_Command84_Click
db.Execute stDocName, dbFailonError
Set db = Nothing
If the query fails for any error control will be transferred to Err_Command84_Click...
When Access VBA sees the Then statement on the same line as the If statement it assumes that there is no Else and doesn't require an End If:
If a = b then c
Try moving the statement after each Then clause to a new line:
If pcktype Like "*Ambulance*" Then
XV = "Ambulance"
ElseIf pcktype...
I wish I could add keys, but I don't own this table. The data is actually from a mainframe report where not all records even have the same data! There are header records and detail records.
I've managed to identify some common fields on the detail records that I am using for my browser. But...
I have a subform that the user can filter. If the user selects a record from the filtered subform and presses a command button I want to "unfilter" (Docmd.ShowAllRecords) the subform, then position the user back on his/her selected record so he can see the record in relationship to those above...
RoyVidar,
Thanks very much for the help. I had to tweak it a bit, but it works fine!
[shadeshappy] Cruising the Information Superhighway at the speed of light
(your mileage may vary)
RoyVidar,
Thanks for the quick reply. I'm not familiar with .currentproject.allforms. I'm still using Access 97. Is this in a later version? If so, can you think of anything I can do in Access 97? I tried your code, but it rejected.
[shadeshappy] Cruising the Information Superhighway...
I am trying to develop an Access application that will use VBA code to open another Access database and create an ASCII file of the names of all forms in that database and the names of the controls contained within each form.
When the forms are in the local database I can walk through the Forms...
If you try to manually import the Excel spreadsheet (i.e. right-click and choose Import) do you get the subscript error? Does the table already exist?
If neither is true, I'm not sure why you're getting the error. Try adding a DoEvents after the RunCommand and see if it clears up the...
dhookom's right. There's no way to do FIRST 10. You can do TOP 10, but you'd have to have a sort field that will enumerate the customers in the order in which you want to pull them off.
Assuming you can do the above, the coding to generate the reports is relatively simple. Create VBA coding...
You should be able to import a file ending in ANY extension as long as you can identify its type. The file may not show up in the Import dialog box when you choose Text as the type, but you can still enter the full name of the file in the File name textbox and it will import.
[shadeshappy]...
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.