philthepowerhouse
IS-IT--Management
Hi there,
I have a form with a button on it. This button takes the information form a combo box also on the form and retrieves the relevant journal details. The user is then presented with the appropriate details of the journal through a form not a report.
In the combo box's list of Journal titles there are some titles that do not have data for them yet probably because they haven't arrived yet. At the moment these journals in question bring up a blank form because there is no data for them as yet.
I would like a message box to appear telling the user this situation. Below is the code behind the button which is linked to the combo box.
...................................
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(Me.Combo2) Then
MsgBox "You Must Select a Journal Title before proceding", vbCritical, "No ItemSelected"
Me.Combo2.SetFocus
Exit Sub
Else
stDocName = "Central Sources Journal Entry Form 2004 2"
stLinkCriteria = "[Title]=" & "'" & Me![Combo2] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Command7_Click:
Exit Sub
Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click
End Sub
.........................................
Let me know if you need anymore info!
Thanks in advance,
Powerhouse.
I have a form with a button on it. This button takes the information form a combo box also on the form and retrieves the relevant journal details. The user is then presented with the appropriate details of the journal through a form not a report.
In the combo box's list of Journal titles there are some titles that do not have data for them yet probably because they haven't arrived yet. At the moment these journals in question bring up a blank form because there is no data for them as yet.
I would like a message box to appear telling the user this situation. Below is the code behind the button which is linked to the combo box.
...................................
Private Sub Command7_Click()
On Error GoTo Err_Command7_Click
Dim stDocName As String
Dim stLinkCriteria As String
If IsNull(Me.Combo2) Then
MsgBox "You Must Select a Journal Title before proceding", vbCritical, "No ItemSelected"
Me.Combo2.SetFocus
Exit Sub
Else
stDocName = "Central Sources Journal Entry Form 2004 2"
stLinkCriteria = "[Title]=" & "'" & Me![Combo2] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_Command7_Click:
Exit Sub
Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click
End Sub
.........................................
Let me know if you need anymore info!
Thanks in advance,
Powerhouse.