Form Text Box

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?
 
G

Guest

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top