vba

comment block in vba msaccess

Enable the edit toolbar, hignlight lines to comment, and click the “comment block” icon on the edit toolbar (middle of toolbar). This will add the ‘ to whatever you highlight.

List of SendKeys

Key Code
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER}or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC} (reserved for future use)
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Keypad add {ADD}
Keypad subtract {SUBTRACT}
Keypad multiply {MULTIPLY}
Keypad divide {DIVIDE}
Key Code
SHIFT +
CTRL ^
ALT %

Check if table is exist vba

Problem:
Check if table is exist

Solution:
Option Compare Database
Public Function TableExists(strTable As String) As Boolean
Dim strName As String

On Error Resume Next
‘If table exists already then strName will be > “”
strName = CurrentDb.TableDefs(strTable).name
TableExists = Not (strName = “”)
End Function

Shell and AppActivate command vba

Problem:
You want to open the file using send key, and active it as a window

Solution:

‘Define the task ID
Dim dTaskID As Integer
‘Open the file with your application
dTaskID = Shell(“applicationYouWantToOpenWith.EXE path+nameofthefile”)
‘Make it active window
AppActivate (dTaskID)

Get Adobe Flash playerPlugin by wpburn.com wordpress themes