Tip Bank

DevX

Stored Access Queries Speed Response Time

In general, stored Access queries are faster than embedded SQL in your VB application. It can be a great benefit to be able to send parameters to the query directly

DevX

Suppress Spaces in a Text Box

To prevent users from typing spaces in a text box, include this code in the KeyPress event of the text box: Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 32

DevX

Is Mail Running?

Use this code to quickly determine whether Microsoft Mail is currently running: Declare Function GetModuleHandle Lib _ “Kernel” (ByVal lpModuleName As String) As IntegerFunction IsMicrosoftMailRunning ()On Error GoTo IsMicrosoftMailRunning_ErrIsMicrosoftMailRunning =

DevX

Find the Name of the Windows or Windows System Directory

You can quickly find the name of the Windows or the Windows System directory. Just pass “WindowsDirectory” or “WindowsSystemDirectory” into this function: Declare Function wu_GetWindows_ Directory Lib “Kernel” Alias _

DevX

Don’t Forget Your References

If you get the error “User-defined type not defined” on a line where you are declaring a database, go to Tools, then go to References, and select the appropriate DAO

DevX

Automatically Resize Controls

Sometimes you need to change the size of controls by changing the size of a container. For example, try this: Private Sub Form_Resize() Picture1.Align = vbAlignLeft Picture1.Align = vbAlignTopEnd Sub

DevX

A New Data Programming Style

While working on VB projects with associated Jet databases, I found that I was creating a lot of individual handling functions for reading, writing, and validating data. It was hard