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)
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.