Form Text Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.. I would like to add a text field to my form which, for the current
record, displays an order date, due date, and send date for job orders. I
would like to add an additional text field (call it txtStatus) which would
indicate the following:

1. When the "due date" was omitted (txtStatus would display "dd omitted")
2. When the "send date" is null and the "due date" is beyond todays date,
(txtStatus would display "pending")
3.When the "send date" is null and we have passed the "due date" (txtStatus
would display "late/pending")
4. When the "send date" is entered and is beyond the "due date" (txtStatus
would display "sent late")

Will someone help me with the VB code to accomplish this?
 
if the status is not stored to the database then you should use a label

private sub Form_Current()
dim strResult as string

if nz(txtDueDate)="" then
strResult="dd Omitted"
elseif nz(txtSendDate)="" and txtDueDate<=date() then
strResult="Pending"
elseif nz(txtSendDate)="" and txtDueDate>date() then
strResult="Late/Pending"
elseif txtSendDate>txtDueDate then
strResult="Sent Late"
end if
txtResult=strResult
end sub

Note if you want to have a realtime status update then you should put this
code seperate and call it for each form_current, senddate_afterupdate and
duedate_afterdate

- Raoul
 
Appreciate the help very much!

JaRa said:
if the status is not stored to the database then you should use a label

private sub Form_Current()
dim strResult as string

if nz(txtDueDate)="" then
strResult="dd Omitted"
elseif nz(txtSendDate)="" and txtDueDate<=date() then
strResult="Pending"
elseif nz(txtSendDate)="" and txtDueDate>date() then
strResult="Late/Pending"
elseif txtSendDate>txtDueDate then
strResult="Sent Late"
end if
txtResult=strResult
end sub

Note if you want to have a realtime status update then you should put this
code seperate and call it for each form_current, senddate_afterupdate and
duedate_afterdate

- Raoul
 
Back
Top