Comact & Repair using DoCmd

I would like to set somw databases to compact & repair when a form is opened 
(using a macro that opens the form from the task scheduler). I tried the 
following code on form load but it wants to create a new table. instead of 
running compact & repair:
Private Sub Form_Load()

DoCmd.DoMenuItem acForm, acTools, acDatabaseUtilities, 
acCompactAndRepairDatabase

End Sub

Any Ideas?
Thanks,

Alan
1
Utf
1/2/2008 8:38:19 PM
access 16762 articles. 3 followers. Follow

6 Replies
1279 Views

Similar Articles

[PageSpeed] 20

hello you!
"Alan" <Alan@discussions.microsoft.com> skrev i melding 
news:A470028B-2D43-49B2-B4C4-CA80C70C8B7A@microsoft.com...
>I would like to set somw databases to compact & repair when a form is 
>opened
> (using a macro that opens the form from the task scheduler). I tried the
> following code on form load but it wants to create a new table. instead of
> running compact & repair:
> Private Sub Form_Load()
>
> DoCmd.DoMenuItem acForm, acTools, acDatabaseUtilities,
> acCompactAndRepairDatabase
>
> End Sub
>
> Any Ideas?
> Thanks,
>
> Alan 

0
Daniel
1/2/2008 8:45:29 PM
"Alan" <Alan@discussions.microsoft.com> wrote in message 
news:A470028B-2D43-49B2-B4C4-CA80C70C8B7A@microsoft.com...
>I would like to set somw databases to compact & repair when a form is 
>opened
> (using a macro that opens the form from the task scheduler). I tried the
> following code on form load but it wants to create a new table. instead of
> running compact & repair:
> Private Sub Form_Load()
>
> DoCmd.DoMenuItem acForm, acTools, acDatabaseUtilities,
> acCompactAndRepairDatabase
>
> End Sub
>
> Any Ideas?


What version of Access?  And is there some special reason you want to open a 
form to do this?  If you're running it from the task scheduler, why bother 
with a user-interface object like a form?

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

0
Dirk
1/2/2008 8:56:03 PM

"Dirk Goldgar" wrote:

> "Alan" <Alan@discussions.microsoft.com> wrote in message 
> news:A470028B-2D43-49B2-B4C4-CA80C70C8B7A@microsoft.com...
> >I would like to set somw databases to compact & repair when a form is 
> >opened
> > (using a macro that opens the form from the task scheduler). I tried the
> > following code on form load but it wants to create a new table. instead of
> > running compact & repair:
> > Private Sub Form_Load()
> >
> > DoCmd.DoMenuItem acForm, acTools, acDatabaseUtilities,
> > acCompactAndRepairDatabase
> >
> > End Sub
> >
> > Any Ideas?
> 
> 
> What version of Access?  And is there some special reason you want to open a 
> form to do this?  If you're running it from the task scheduler, why bother 
> with a user-interface object like a form?
> 
> -- 
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
> 
> (please reply to the newsgroup)

I didn't know you could run compact & repair from the task scheduler by 
itself. I run macros from the task scheduler and the only way I could think 
of to run the compact & repair using a macro would be using the DoCmd on form 
load. I didn't think until I just typed the reply I could use the run command 
in the macro. Thanks,
your reply sent me in the right direction!
> 
0
Utf
1/4/2008 8:02:03 PM

"Alan" wrote:

> 
> 
> "Dirk Goldgar" wrote:
> 
> > "Alan" <Alan@discussions.microsoft.com> wrote in message 
> > news:A470028B-2D43-49B2-B4C4-CA80C70C8B7A@microsoft.com...
> > >I would like to set somw databases to compact & repair when a form is 
> > >opened
> > > (using a macro that opens the form from the task scheduler). I tried the
> > > following code on form load but it wants to create a new table. instead of
> > > running compact & repair:
> > > Private Sub Form_Load()
> > >
> > > DoCmd.DoMenuItem acForm, acTools, acDatabaseUtilities,
> > > acCompactAndRepairDatabase
> > >
> > > End Sub
> > >
> > > Any Ideas?
> > 
> > 
> > What version of Access?  And is there some special reason you want to open a 
> > form to do this?  If you're running it from the task scheduler, why bother 
> > with a user-interface object like a form?
> > 
> > -- 
> > Dirk Goldgar, MS Access MVP
> > www.datagnostics.com
> > 
> > (please reply to the newsgroup)
> 
> I didn't know you could run compact & repair from the task scheduler by 
> itself. I run macros from the task scheduler and the only way I could think 
> of to run the compact & repair using a macro would be using the DoCmd on form 
> load. I didn't think until I just typed the reply I could use the run command 
> in the macro. Thanks,
> your reply sent me in the right direction!
> > 

I tried running compact & repair from the run command in a macro but I get 
an error message "You can't run Compact & Repair wheile a macro is open or 
running"
0
Utf
1/7/2008 4:31:03 PM
"Alan" <Alan@discussions.microsoft.com> wrote in message 
news:048D39A8-C893-4FCB-AE33-2ECC8C02B3EB@microsoft.com...
>
>
> I tried running compact & repair from the run command in a macro but I get
> an error message "You can't run Compact & Repair wheile a macro is open or
> running"


Did you try starting Access with the /compact command-line option?  See this 
help topic for a list of command-line options:

    http://office.microsoft.com/assistance/hfws.aspx?AssetID=HP051883001033

For example, you might execute this command line from the task scheduler:

    "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" 
"C:\SomeFolder\YourDB.mdb" /compact


Note that the above example will have been broken onto two lines by the 
newsreader, but it's meant to be all on one line.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

0
Dirk
1/7/2008 6:16:43 PM
Thanks,

that is definetly the way to do it, it works fine. Funny the book I have 
desn't even mention the command line startup options.

Alan

"Dirk Goldgar" wrote:

> "Alan" <Alan@discussions.microsoft.com> wrote in message 
> news:048D39A8-C893-4FCB-AE33-2ECC8C02B3EB@microsoft.com...
> >
> >
> > I tried running compact & repair from the run command in a macro but I get
> > an error message "You can't run Compact & Repair wheile a macro is open or
> > running"
> 
> 
> Did you try starting Access with the /compact command-line option?  See this 
> help topic for a list of command-line options:
> 
>     http://office.microsoft.com/assistance/hfws.aspx?AssetID=HP051883001033
> 
> For example, you might execute this command line from the task scheduler:
> 
>     "C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" 
> "C:\SomeFolder\YourDB.mdb" /compact
> 
> 
> Note that the above example will have been broken onto two lines by the 
> newsreader, but it's meant to be all on one line.
> 
> -- 
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
> 
> (please reply to the newsgroup)
> 
0
Utf
1/7/2008 7:34:02 PM
Reply:

Similar Artilces:

using VBA to print Header & footer
Hi, What VBA code should I use in a worksheet so it will print a header & Footer? On Nov 28, 12:43=A0pm, nickbest_l...@hotmail.com wrote: > Hi, > What VBA code should I use in a worksheet so it will print a header & > Footer? Have you tried doing it manually while recording a macro...?? On Nov 28, 9:29=A0pm, Don Guillett <dguille...@gmail.com> wrote: > On Nov 28, 12:43=A0pm, nickbest_l...@hotmail.com wrote: > > > Hi, > > What VBA code should I use in a worksheet so it will print a header & > > Footer? > > Have you tried doing it manua...

Using Investment "Cash" account for a Savings Account?
I just joined another credit union for the sole purpose of purchasing certificates of deposits there. To maintain a membership, they require that $5 be held in a savings account under my name. When I buy a CD, I have to deposit money into that savings account and then they will immediately transfer it to the CD. Although I could if I wanted to, I have no intention of depositing any other funds to this savings account except with the intent of purchasing CDs. I setup the savings account in Microsoft Money and then added the Ceritificate of Deposit as an investment account. When I did so, Micro...

inbox repair #2
vikash@rfl.co.za <anonymous@discussions.microsoft.com> wrote: <blank message> And the question is??? -- Brian Tillman ...

Deleting files before Repairing or Re-installing Office or if corrupt
Greetings. I'm building a small free EXE that will do the following: delete all EXD files delete all files in docs and settings Temp folders and subfolders (for XP) delete alll files in user Temp folders and subfolders (for Vista) delete all files in the Windows Temp folder and subfolders delete all XLB files Each step is optional. The purpose is to clean the PC before doing a repair or re-install or to just remove the XLB file if it becomes corrupt My question: are there any other files that should be deleted prior to repairing or re-intalling office? Or become corrupt and someti...

RMS after repairs
Hello. I use a laptop as my register and I had to send it off for repairs, but before i did i took it to the Geek Squad to remove the data. I loaded RMS to my other laptop, but i can't get the information it to pull the data off the disc. Please help. I can't get any work done without it and i'm affraid that all data will be lost because Sony is going to wipe out my hard drive completely. In desparate need of a reply. Blue -- Blue Valentine Fashions for All of Your Nightly Affairs Itdepends on how you saved your data. If you did a normal backup [via RMS Administrat...

Weed out words using Excel?? #2
Weed out words using Excel?? Is there a way to automatically isolate an appearance of a word in a list of words, eg I have a full dictionary of words, as a text file, and I want to end up with a list where the word (for example) "log" appears. So if the big list contains: logarithm chair table catalogue (each on a seperate line) The list I would want would be: logarithm catalogue (leaving out the others) Thanks. Dear Mike Using cutom filtering might be the answer here. To do this open the "Data" menu and select "Filter" then "Autofilter". once t...

Detect & Repair Question Please
I am running XPPro & Office 2000 Small Business edition. Every so often Outlook refuses to start & I must run "detect & repair" and that fixes it okay (I still don't know what's causing this however). My question is: when I chose "detect & repair" I an asked to put in my original installation disc. This is a pain. Surely whatever detect & repair is looking for can be installed on my hard drive so I don't have to keep going back to the install disc. Help please. Thanks in advance... Bob ...

Using Act with Outlook
I am using Act contact management software with Outlook 2003 as my e-mail client. When I try to pull up my e-mail in Act a pop-up comes up saying that an unknown program is trying to access Outlooks contact manager. How can I preven this from happening. ...

2007 Ribbon interface is less useful than 2003 toolbars
The new ribbon interface: I can't see what font size, style, etc are applied to the current selection without navigating to the home ribbon. I can't drag the palette off to hover over the screen. (also see suggestion Subject: Theme Colors are horrible! By: paul89 In: microsoft.public.excel.misc) The buttons are massive - if I was my granny or used a touch screen I might be grateful. Keyboard users rather than people who do everything with a mouse are worse off. It keeps moving so I have to look to see what ribbon I'm on before I can use a command. The ribbon t...

How can I use outlook without a web connection to the computer
When I try to open Outlook 2000 it says can't find email and wont open. This is on my laptop which does not have an internet connection. I just want to use calendar and tasks dranrebt <dranrebt@discussions.microsoft.com> wrote: > When I try to open Outlook 2000 it says can't find email and wont > open. This is on my laptop which does not have an internet connection. > I just want to use calendar and tasks Uninstall it and reinstall it in "No Mail" mode. -- Brian Tillman ...

We are using eSafe
We have an eSafe appliance by Aladin filtering spam and viruses in and out. It is doing a good job for my 4000 users. Convince the boss not to quarenteen messages. Their support was lacking when we first got the box but after a long conversation with a VP I think they have made great strides fixing that problem. Fred ...

Create Outlook 2003 Rule using 'Or' operator in 'Sent to' condition
How do I create a rule that uses the 'or' operator in the 'sent to' condition? I actually have a rule like this, but don't know how I created it. In other rules, when I try to add more that one email address or group in 'sent to,' Outlook inserts the 'and' operator. What is the exact rule in full? In general you'd create additional rules but it depends a bit on the condition or action that you are using. -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins ...

inbox repair?
how do you repair an inbox in exchange 5.5? it says i should run it, but it doesnt tell me how to do it. i also have not been able to find it using the "help" supplied. The Inbox repair tool is actually called scanpst.exe and can only repair your Inbox if that Inbox is stored in a local PST file. To find it just search your C drive...it'll be there somewhere. -Peter "chris" <anonymous@discussions.microsoft.com> wrote in message news:012801c3bf41$7b7ee8c0$a301280a@phx.gbl... > how do you repair an inbox in exchange 5.5? it says i > should run it, but it ...

docmd.sendobject
Outlook 2003 does not accept message text from DoCmd.SendObject command in access database. All other fields pass to the message fine. Is there a setting in outlook 2003 that causes this? It works fine if I use Outlook 97 as my default mail program. DoCmd.SendObject , , "MSTXT", "recipient", "cc", "bcc", "subject", "Message text" ...

Unable to use Word in Outlook
I am using Outlook in windows-xp platfarm. Also I have selected WORD as the mail editor. It was working well. Now, if I open new-mail, word is not responding and it just hangs. I have to press ctrl-alt-del to come out from outlook. If I disable 'word' as editor, I can able to prepare new mails,can make reply & forward etc. Also, Word is working well on its own. Outlook version : Outlook 2002 Operating system : Microsoft Windows XP Tablet PC Edition Version 2002 Service Pack-1 kindly suggest a solution regards Selvara...

Contracts and Accounts Used for Posting
My client is implementing Contracts Administration. They would like to have the sales and accued liability accounts used by revenue recognition to be driven by the item number and not the contract type. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.micr...

Using a time chart
I am attaching an example of what I need. The green areas can also be marked with "-" or "+" if needed. On sheet 2 you will see what I need the results to be. I just want this to be done with a formula or a macro. I want to change what is on sheet one and have the results change on sheet two. File Attached: http://www.excelforum.com/attachment.php?postid=319230 (cashier schedules.xls) ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ since you a...

Comact & Repair using DoCmd
I would like to set somw databases to compact & repair when a form is opened (using a macro that opens the form from the task scheduler). I tried the following code on form load but it wants to create a new table. instead of running compact & repair: Private Sub Form_Load() DoCmd.DoMenuItem acForm, acTools, acDatabaseUtilities, acCompactAndRepairDatabase End Sub Any Ideas? Thanks, Alan hello you! "Alan" <Alan@discussions.microsoft.com> skrev i melding news:A470028B-2D43-49B2-B4C4-CA80C70C8B7A@microsoft.com... >I would like to set somw databases to compact &...

Installing & Using CRM without Exchange Server
My company is looking into using CRM without Microsoft Exchange for the time being. Can CRM work with POP/Smtp mail hosted by our ISP? Can you still send mail out thru CRM? Can you still promote emails into CRM? What functions do you loose when you don't have Exchange. Is anyone using CRM without Exchange and have an Positive experience. Any Feedback is good. Thanks! CRM will only send and receive email through the CRM Exchange connector which as its name suggests only works on Exchange 2000 "atl" <atloak357@hotmail.com> wrote in message news:ug7l2bafDHA.2320@T...

am unable to view or use sheet tabs
Trying to copy excel worksheet to powerpoint. Closed Excel program. Now am unable to see the worksheet tabs, let alone use them. Ditto for the original that was emailed to me when I went back with the thought of re-downloading it. TOOLS / OPTIONS / SHEET TABS HTH, Gary Brown "dazed and confused" wrote: > Trying to copy excel worksheet to powerpoint. Closed Excel program. Now am > unable to see the worksheet tabs, let alone use them. Ditto for the original > that was emailed to me when I went back with the thought of re-downloading it. tools>options>VIEW>sh...

using outlookweb access
Hi, i don't know if any one can help me on this. Here it is. I am using microsoft Outlook webaccess to access my e- mail from the office while i am at home. But i also want to be able to browse my company's network at home also, and have access to files and folders,so that i can do work from home. Is this possible. Please resond, this is very urgent. They could set up VPN for you... "Anna" <annam@patnt.com> wrote in message news:04ed01c3a391$ed4a70d0$a001280a@phx.gbl... > Hi, i don't know if any one can help me on this. Here it > is. I am using micros...

Use Numbers in Specific Cell
Good afternoon, I found this while doing a search. It works fine, but how can I adapt it to take the number of balls drawn which is in cell H3, the number of balls drawn from which is in cell I3 and the number of combinations I want to randomly produce x number of combinations which is in cell J3. These three cells are in a worksheet called =91Random Numbers=92. Sub lottery() Dim my(1 To 49) For j =3D 1 To 10 ' Reinit array before selecting For I =3D 1 To 49 my(I) =3D I Next I For k =3D 1 To 6 Randomize NewNumber: Number =3D Int(49 * Rnd) + 1 If my(Number)...

Update using SELECT
Hi, Can anyone help me how to Update an existing SQL Server 2008 table using the following select statement: SELECT TOP 1 SNAME, COUNT(*)[SNAME_CNT] FROM ConusSolLyr WHERE TAXCL <> ' ' AND TAXOR = 'Alfisols' GROUP BY SNAME ORDER BY SNAME_CNT DESC I'd like to update TaxOrder table's SNAME field with the resulting value of SNAME from the above select statement. Thanks so much in advance. Hi Use common table expression WITH cte AS ( SELECT COUNT() OVER (PARTITION BY SNAME ),[SNAME_CNT] ,SNAME FROM ConusSolLyr WHERE TAXCL <> '...

Unknown repair
I have recently moved from Excel 2002 to 2007 and when saving a large file with several macros and reopening it keeps saying that there is unreadable content and that a repair had to be made. I don't know how to get rid of this problem and I can see no external links to '.xml' files. Any help gratefully received. Repaired Records: External formula reference from /xl/externalLinks/externalLink8.xml part (Cached values from external formula reference) Repair log: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - ...

Can you use a hanging indent in an Excel cell?
I am trying to create a list in Excel but some descriptions are lengthly. It would be easier to distinguish between each item if, as a description wraps in the cell, a hangin indent was in place. Hi DBTI Hanging indents no, indents yes To create a hanging indent look alike, type five spaces before your text. "DBTI" wrote: > I am trying to create a list in Excel but some descriptions are lengthly. It > would be easier to distinguish between each item if, as a description wraps > in the cell, a hangin indent was in place. ...