I created a help file in access that lets you have text mesasge up to 1024 chars. Just press F1 key on any control that you have setup to bring up help message.
Does any one see any problems with the way I did this?
Form
Help File: = ""
Help Context ID: = 0
For each control on the form where you would like to have a help message do the following.
Form
Control
Help Context ID: = Set to one of the help index numbers in the help table.
Add KeyDown Event to the control
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
'Add this line
KeyCode = DisplayHelp(KeyCode, Me.ActiveControl.HelpContextId)
End Sub
module
Function DisplayHelp(KeyCode As Integer, HelpContextId As Integer) As Integer
Dim dbs As DAO.Database
Dim rstRecords As DAO.Recordset
If KeyCode = VBKeyF1 Then ' 112 = F1
Set dbs = CurrentDb
Set rstRecords = dbs.OpenRecordset("SELECT tlbHelp.Index, tlbHelp.HelpMessage " & _
"FROM tlbHelp WHERE (((tlbHelp.Index)=" & HelpContextId & "));")
With rstRecords
If .RecordCount > 0 Then
Call MsgBox(!HelpMessage, vbInformation, "Help")
End If
End With
DisplayHelp = 0 ' Clear KeyCode
rstRecords.Close
Set dbs = Nothing
Else
DisplayHelp = KeyCode
End If
End Function
Create Table and Fields
Table Name: tlbHelp
Field Name: Index as Number
Field Name: HelpMessage as Memo
Field Name: FieldName as Text
Field Name: FormName as Text
How type in custom number and message for each help message.
Does any one see any problems with the way I did this?
Form
Help File: = ""
Help Context ID: = 0
For each control on the form where you would like to have a help message do the following.
Form
Control
Help Context ID: = Set to one of the help index numbers in the help table.
Add KeyDown Event to the control
Private Sub Text0_KeyDown(KeyCode As Integer, Shift As Integer)
'Add this line
KeyCode = DisplayHelp(KeyCode, Me.ActiveControl.HelpContextId)
End Sub
module
Function DisplayHelp(KeyCode As Integer, HelpContextId As Integer) As Integer
Dim dbs As DAO.Database
Dim rstRecords As DAO.Recordset
If KeyCode = VBKeyF1 Then ' 112 = F1
Set dbs = CurrentDb
Set rstRecords = dbs.OpenRecordset("SELECT tlbHelp.Index, tlbHelp.HelpMessage " & _
"FROM tlbHelp WHERE (((tlbHelp.Index)=" & HelpContextId & "));")
With rstRecords
If .RecordCount > 0 Then
Call MsgBox(!HelpMessage, vbInformation, "Help")
End If
End With
DisplayHelp = 0 ' Clear KeyCode
rstRecords.Close
Set dbs = Nothing
Else
DisplayHelp = KeyCode
End If
End Function
Create Table and Fields
Table Name: tlbHelp
Field Name: Index as Number
Field Name: HelpMessage as Memo
Field Name: FieldName as Text
Field Name: FormName as Text
How type in custom number and message for each help message.