MSAccess VBA: Compact and Repair Database

========= QUESTION --------- Is it possible to Compact and Repair a Microsoft Access database from VBA?   ========= ANSWER --------- The short answer is no. HOWEVER - we were lucky enough after much research to stumble across an obscure forum post discussing how to do it via simply sending keys via VBA! See Examples.   [...]

By |2017-12-01T23:47:24+00:00January 21st, 2015|Access, Computers, Documentation, Microsoft, VBA|Comments Off on MSAccess VBA: Compact and Repair Database

VBA RND() Function: Pick a random number

========= QUESTION ---------How do I generate a random number between X and Y?    ========= ANSWER ---------See EXAMPLES    ========= EXAMPLES --------- Int ((999 - 100 + 1) * Rnd + 100) would return a random number between 100 and 999   ========= APPLIES TO / KEY WORDS --------- Random Numbers    ========= REF ---------http://www.techonthenet.com/excel/formulas/rnd.php   ---http://anySiteSupport.com [...]

By |2013-06-04T19:39:01+00:00June 4th, 2013|Access, Computers, Documentation, Microsoft, VBA|Comments Off on VBA RND() Function: Pick a random number

Access: VBA: Run several buttons at once

========= QUESTION --------- Is it possible to code the event on one button to execute several buttons at once on an Access Form?   ========= ANSWER --------- Yes - simply enter the following in the code for the 'master button'  Private Sub MasterButton_Click()    Call Button1_Click    Call Button2_ClickEnd Sub   ========= EXAMPLES ---------   ========= APPLIES [...]

By |2017-12-01T23:47:27+00:00May 7th, 2013|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Access: VBA: Run several buttons at once

Extract every other character from a string

========= QUESTION --------- I have a long number that I need to collect the 2nd, 4th, 6th, and 8th characters from.   ========= ANSWER ---------see EXAMPLES   ========= EXAMPLES ---------Store: Mid([SurvNum_Span],2,1) & Mid([SurvNum_Span],4,1) & Mid([SurvNum_Span],6,1) & Mid([SurvNum_Span],8,1)   ========= APPLIES TO / KEY WORDS ---------Microsoft Access VBA String Manipulation   ========= REF --------- http://ycmi.med.yale.edu/nadkarni/access_course/String_Frame.htm   [...]

By |2012-02-12T15:08:57+00:00February 12th, 2012|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Extract every other character from a string

VBA: Run a command at the command prompt from VBA

========= QUESTION --------- How do I run a DOS command at the Command prompt from VBA?   ========= ANSWER --------- see EXAMPLES   ========= EXAMPLES --------- Shell "cmd.exe /k dir c:windowssystem*.exe", vbNormalFocus ...consider running a .bat file for more involved commands?   ========= APPLIES TO / KEY WORDS --------- Microsoft Access VBA Command Prompt Commands [...]

By |2011-12-16T07:54:56+00:00December 16th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on VBA: Run a command at the command prompt from VBA

VBA: Run Saved Export

========= QUESTION --------- Can you execute or run a Saved Export in Microsoft Access from VBA?   ========= ANSWER --------- Yes - see EXAMPLES   ========= EXAMPLES --------- DoCmd.RunSavedImportExport "NameOfSavedExport"   ========= APPLIES TO / KEY WORDS --------- Saved Export Saved Import   ========= REF ---------http://bytes.com/topic/access/answers/895859-how-can-i-run-saved-export-vba   ---http://www.anysitesupport.com/vba-run-saved-export/ http://anySiteHosting.com

By |2011-12-08T13:14:17+00:00December 8th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on VBA: Run Saved Export

VBA: Find and Replace in a String

========= QUESTION --------- How do I do a find and replace within a string using VBA? How do I replace a character in a string?   ========= ANSWER --------- see EXAMPLES   ========= EXAMPLES --------- Sometimes you will stumble across someone having entered a phone number in a database with a "/" between the area [...]

By |2017-12-01T23:47:34+00:00December 7th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on VBA: Find and Replace in a String

VBA: Disable Button after Clicking

========= QUESTION ---------I want to disable a button after the user has clicked it in my Form - is this possible?   ========= ANSWER --------- Very simple - see EXAMPLES   ========= EXAMPLES --------- clickedButton.Enabled = false   ========= APPLIES TO / KEY WORDS --------- Microsoft Access VBA Button Command Button Enable Disable   ========= [...]

By |2017-12-01T23:47:35+00:00November 2nd, 2011|Computers, Documentation, Microsoft, VBA|Comments Off on VBA: Disable Button after Clicking

VBA Error: Too Many Line Continuations

========= QUESTION --------- To keep my VBA code clean, I use quite a few line continuations ( & _ ). Recently, however, Access errored out on me with the note: Too Many Line Continuations. Is there a way to work around this?   ========= ANSWER --------- Yep - just trick it by setting half your [...]

By |2011-10-31T07:18:31+00:00October 31st, 2011|Computers, Documentation, Microsoft, VBA|Comments Off on VBA Error: Too Many Line Continuations

Can I backup my VBA code?

========= QUESTION --------- I have been having a lot of trouble lately with my Microsoft Access database files being corrupted and losing all of my code. (a sometimes fix for this: http://www.anysitesupport.com/error-microsoft-access-has-stopped-working/) The scary thing is even when I attempt to open the backups, they may work, but the code still disappears! Is there a [...]

By |2017-12-01T23:47:35+00:00October 26th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Can I backup my VBA code?
Go to Top