Sam Summers
Registered User.
- Local time
- Today, 21:16
- Joined
- Sep 17, 2001
- Messages
- 939
Hi, here i am again.
I have a form (ViewVessel) with a tabbed form on it with a subform on one of the tabs (MaintenanceSubform).
On the 'MaintenanceSubform' i have a combobox control 'Status' whose RowSource is a table 'Status'.
Column(0) is the primary key and there are three items in the table from 1 to 3 (In Service; Out of Service; Awaiting Parts).
Column Count = 3, Column widths = 0cm;0cm;4cm
Bound Column = 1
When the user selects one of these items, if it is In Service (1) then 'ViewVessel' Textbox 'NewStatus' is updated.
If they select Out of Service (2) or Awaiting Parts (3) this code should be run:
However when i run it after selecting 'In Service' (1) it still runs the code?
When i break it and hover over line 16 (If Me.Status.Column(0) = "2" Or "3" Then) i can see that 1 is indicated?
Also continuing on in the code it breaks at this line - Forms!ViewVessel.VesselName.SetFocus. sayng that it cannot set the focus?
I am totally baffled by this and have tried it in the BeforeUpdate Event as well but it still doesnt do anything apart from send me emails.
I would be very grateful if someone can assist with my obvious stupidity..........
I have a form (ViewVessel) with a tabbed form on it with a subform on one of the tabs (MaintenanceSubform).
On the 'MaintenanceSubform' i have a combobox control 'Status' whose RowSource is a table 'Status'.
Column(0) is the primary key and there are three items in the table from 1 to 3 (In Service; Out of Service; Awaiting Parts).
Column Count = 3, Column widths = 0cm;0cm;4cm
Bound Column = 1
When the user selects one of these items, if it is In Service (1) then 'ViewVessel' Textbox 'NewStatus' is updated.
If they select Out of Service (2) or Awaiting Parts (3) this code should be run:
Code:
Private Sub Status_AfterUpdate()
Dim strTo As String
Dim strMessage As String
Dim strSubject As String
Dim attch As String
Dim lngWhite As Long
Dim strText As String
Dim Cvessel As String
DoCmd.OpenQuery "RecordMaintenanceQry"
' Forms![ViewVessel].Requery
' Forms![ViewVessel]![MaintenanceSubform].Requery
' Forms![MainPanel].Requery
If Me.Status.Column(0) = "2" Or "3" Then
' Forms![MainPanel].Requery
strTo = "xxxxxxxxxxxxxxx.com"
strSubject = "Outage Report. "
Forms!ViewVessel.VesselName.SetFocus
Cvessel = Forms![ViewVessel]![VesselName].Text
strText = " has just been reported as out of service"
strMessage = Cvessel & strText
Call SendEmailWithOutlook(strTo, strSubject, strMessage, attch)
DoCmd.RunCommand acCmdSaveRecord
Else
End If
End Sub
However when i run it after selecting 'In Service' (1) it still runs the code?
When i break it and hover over line 16 (If Me.Status.Column(0) = "2" Or "3" Then) i can see that 1 is indicated?
Also continuing on in the code it breaks at this line - Forms!ViewVessel.VesselName.SetFocus. sayng that it cannot set the focus?
I am totally baffled by this and have tried it in the BeforeUpdate Event as well but it still doesnt do anything apart from send me emails.
I would be very grateful if someone can assist with my obvious stupidity..........