VBA: Change the Color of an Object

========= QUESTION --------- I need to change the color of an object from within my VBA code.   ========= ANSWER --------- See EXAMPLES   ========= EXAMPLES --------- Private Sub ReLinkTables_Click()  Me.ReLinkTables.BackColor = RGB(186, 20, 25) Me.ReLinkTables.ForeColor = Hex(FFF200) Me.CurrentStatusLabel.Caption = "Clicked: ReLink Tables" Me.CurrentStatusLabel.BackColor = Me.CurrentStatusLabel.ForeColor = vbWhite Me.CurrentStatus = _ "Opening Linked Table Manager" & [...]

By |2011-06-20T08:05:33+00:00June 20th, 2011|Computers, Documentation, Microsoft, VBA|Comments Off on VBA: Change the Color of an Object

VBA: Access: Calling Linked Table Manager

========= QUESTION --------- Can you call or open the Linked Table Manager in Microsoft Access from your VBA code?   ========= ANSWER --------- See EXAMPLES --------- Another interesting way of doing this would be to simply execute a query in your VBA code against each linked table in your database, thereby causing the logon prompt [...]

By |2017-12-01T23:47:41+00:00June 15th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on VBA: Access: Calling Linked Table Manager

VBA: Can you open Windows Explorer from VBA?

========= QUESTION --------- Can I open Windows Explorer from my VBA code?   ========= ANSWER --------- See EXAMPLES   ========= EXAMPLES --------- Private Sub WindowsExplorer_Click() Dim rst As RecordsetDim retval As String Set rst = CurrentDb.OpenRecordset("Parms")retval = Shell("explorer.exe " & rst!Path, vbNormalFocus)Set rst = NothingEnd Sub   ========= APPLIES TO / KEY WORDS --------- Microsoft [...]

By |2011-06-15T13:27:19+00:00June 15th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on VBA: Can you open Windows Explorer from VBA?

VBA: How to put double quotes in a string

========= QUESTION --------- I need to have double quotes (") in a string in VBA, as I am entering WHERE statements in a SQL statement, but every time I have quotes in a string, it errors out.   ========= ANSWER --------- Any time you have double quotes ("), simply double them ("") and you will [...]

By |2017-12-01T23:47:41+00:00June 15th, 2011|Access, Documentation, Microsoft, VBA|Comments Off on VBA: How to put double quotes in a string

Access: Run-time error 13 Type MisMatch

========= QUESTION --------- I converted a Microsoft Access database from .mdb to .accdb format, and now when I run my usual VBA code to export a report to PDF, it gives me the error: Run-time error ‘13’: Type mismatch   ========= ANSWER --------- If you are not using an ADO object library, clear the reference to [...]

By |2017-12-01T23:47:41+00:00June 7th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Access: Run-time error 13 Type MisMatch

Access VBA: Export to Spreadsheet

========= QUESTION --------- How do I export to a spreadsheet using VBA?   ========= ANSWER --------- See EXAMPLES   ========= EXAMPLES --------- MyFilePath = "C:Test" Me.Status = "Creating Spreadsheet file" Me.Repaint DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ReportOrQueryName", MyFilePath & "FileName.xls" --------- Me.CurrentStatus = _ "Exporting to Excel for Distribution" & vbCrLf & _ Now() & vbCrLf & _ vbCrLf & _ [...]

By |2011-06-07T17:47:17+00:00June 7th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Access VBA: Export to Spreadsheet

Access VBA: Date modified of table

========= QUESTION --------- I want to show the date the table was last modified   ========= ANSWER --------- See EXAMPLES   ========= EXAMPLES --------- Me.Signature2.Value = CurrentDb.TableDefs("ControlPanel").Properties("LastUpdated")   ========= APPLIES TO / KEY WORDS --------- Microsoft Access VBA Date Modified   ========= REF --------- http://www.accessmonster.com/Uwe/Forum.aspx/access-modulesdaovba/30880/Access-VBA-Date-Modified   ---http://www.anysitesupport.com/access-vba-date-modified-of-table/ http://anySiteHosting.com

By |2017-12-01T23:47:48+00:00May 23rd, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Access VBA: Date modified of table

Access VBA: How to copy a table

========= QUESTION --------- How do I copy a table using VBA or SQL in Access?   ========= ANSWER --------- See EXAMPLES NOTE: the use of of the square brackets ("[" and "]") will save you a lot of grief! For instance in the example below, the date formatting having hyphens in it screws up the [...]

By |2017-12-01T23:47:49+00:00May 12th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Access VBA: How to copy a table

Access: How do I open a new email message from VBA?

========= QUESTION ---------How do I open a new email message from VBA?   ========= ANSWER ---------See EXAMPLES   ========= EXAMPLES ---------Dim olLook As Object 'Start MS OutlookDim olNewEmail As Object 'New email in OutlookDim strContactEmail As String 'Contact email address Set olLook = CreateObject("Outlook.Application")Set olNewEmail = olLook.createitem(0)strEmailSubject = "TopSellers.accdb Application"strEmailText = ""strContactEmail = NAME@DOMAIN With [...]

By |2011-05-05T09:08:36+00:00May 5th, 2011|Access, Computers, Documentation, Microsoft, VBA|Comments Off on Access: How do I open a new email message from VBA?

Access: VBA to open Internet Explorer

========= QUESTION ---------How do I open a web site from VBA? How do I open a url from VBA? How do I use VBA to open Internet Explorer?   ========= ANSWER ---------See Examples   ========= EXAMPLES ---------Private Sub ViewURL_Click() Set browser = CreateObject("InternetExplorer.Application")browser.Navigate ("http://www.Google.com")browser.StatusBar = Falsebrowser.Toolbar = Falsebrowser.Visible = Truebrowser.Resizable = Falsebrowser.AddressBar = True End [...]

By |2011-05-04T10:47:37+00:00May 4th, 2011|Access, Documentation, Microsoft, VBA|Comments Off on Access: VBA to open Internet Explorer
Go to Top