Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If "status" = condition then update date [sadeyes]

Status
Not open for further replies.

MsMope

IS-IT--Management
Sep 3, 2003
83
US
hello,
I am reviewing the attached code and trying to add an additional job status condition, "on hold" If this is the chosen condition I want to input the system date into ctldate_changed. However, when I attempt to do this I recieve error " | is not found", or ctldate_changed, must have focus, if I try to set focus I recieve error that the control cannot recieve focus, it is a textbox.

Private Sub ctlJob_Status_AfterUpdate()
If ctlJob_Status = "Shipped" Then
Forms!api_frmItem.SKMInventoryRelief
End If

If [ctlJob_Status].Text = "Startlayout" And IsNull([ctlDate Startlayout]) Then
[ctlDate Startlayout].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Outforapproval" And IsNull([ctlDate Outforapprov]) Then
[ctlDate Outforapprov].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Approved" And IsNull([ctlDate_Approved]) Then
[ctlDate_Approved].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Checkin" And IsNull([ctlDate Checkin]) Then
[ctlDate Checkin].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Engineering" And IsNull([ctlDate Engineered]) Then
[ctlDate Engineered].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Cut" And IsNull([ctlDate Cut]) Then
[ctlDate Cut].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Built" And IsNull([ctlDate Built]) Then
[ctlDate Built].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Shipped" And IsNull([ctlDate Shipped]) Then
[ctlDate Shipped].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Hangers" And IsNull([ctlDate Hangers]) Then
[ctlDate Hangers].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Seals" And IsNull([ctlDate Seals]) Then
[ctlDate Seals].Value = CStr(Date)
ElseIf [ctlJob_Status].Text = "Invoiced" Then
ctlTruss_Price.Locked = True
ctlHanger_Price.Locked = True
ctlSelling_Price.Locked = True
ctlEngLum_Price.Locked = True
End If

End Sub
 
What application?

Excel/Word userform?
Access form?

If this is Access:

Try addressing ctldate_changed like this:

[tt]me!ctldate_changed.value = now[/tt]

The error with a pipe (|), would probably refer to a control that Access can't find (or find the name of/resolve at runtime) when the code executes - is it on the current form? If not, use a fully qualified reference.

[tt]forms!NameOfYourForm!ctldate_changed.value = now[/tt]

The message about ctldate_changed must have focus, seems to relate to using the .Text property of that control when it doesn't have focus - use the value property of controls for all "normal" referencing. If you need to work with with "freshly" typed text that's not yet "saved" to the control, for instance when working with the on change event, or keydoewn event, then use the .Text property - the control needs to have focus to address that property.

For Access - doing a forum search for Access will reveal 7 specific "pure" access fora.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top