A google search brought this code:
copy all of it into a module in your database:
Private Const WM_SETICON = &H80
Private Const IMAGE_ICON = 1
Private Const LR_LOADFROMFILE = &H10
Private Const SM_CXSMICON As Long = 49
Private Const SM_CYSMICON As Long = 50
Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" _
(ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, _
ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Function SetFormIcon(hwnd As Long, strIconPath As String) As Boolean
Dim lIcon As Long
Dim lResult As Long
Dim x As Long, y As Long
x = GetSystemMetrics(SM_CXSMICON)
y = GetSystemMetrics(SM_CYSMICON)
lIcon = LoadImage(0, strIconPath, 1, x, y, LR_LOADFROMFILE)
lResult = SendMessage(hwnd, WM_SETICON, 0, ByVal lIcon)
End Function
then put:
SetFormIcon Me.hwnd, "C:\xp.ico"
in the OnLoad event, passing the full path to the icon of your choice.
Cheers
Ben
----------------------------------------------
Ben O'Hara
"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------