update a date field with the date a button is pressed on a form.

G

Guest

Hello, i would like to have a date field update with the date that a button
is pressed. The button sends an email to a colleague to inform them that a
record is available for them to update with a price.
I will then create a report that will list the the records with the date i
sent the email and the date that the price is added and sent to the customer
(price sent is already a field within the form).

as usuall any help greatly appreciated.

regards
 
A

Al Campagna

Maax,
It would have been helpful if you had provided the names of the button and the date
field, so... I'll use my own names.
I'll also assume that the button and the date field are on the Main form...
Private Sub SomeButton_Click()
SomeDateField = Date()
' your code to send email here
End Sub
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
G

Guest

Hi Al, i added the line SomeDateField = Date() to the code i already had for
the email button. it works a treat ....thanks.

I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it. i can kind of picture the simple
code for this but not sure where to put it?

could you possibly help me (yet again)?

thanks
 
A

Al Campagna

Maax,
You actually solved your own problem with this "textual" statement...
I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it.
Just convert that same "logic" to an IF statement to exit the sub if any of those
conditions does not exist.

Private Sub SomeButton_Click()
If [Status] <> "Engineered" and IsNull([BOM]) and IsNull(Labour) Then
Exit Sub
End If
SomeDateField = Date()
' your code to send email here
End Sub

All 3 criteria must be met before the Date is set, and the Email sent...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
G

Guest

Thanks Al, i could not think where to put the code. I will put it in "on
exit" as you suggest. Its obvious now you have said it.

thanks again

Al Campagna said:
Maax,
You actually solved your own problem with this "textual" statement...
I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it.
Just convert that same "logic" to an IF statement to exit the sub if any of those
conditions does not exist.

Private Sub SomeButton_Click()
If [Status] <> "Engineered" and IsNull([BOM]) and IsNull(Labour) Then
Exit Sub
End If
SomeDateField = Date()
' your code to send email here
End Sub

All 3 criteria must be met before the Date is set, and the Email sent...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Maax said:
Hi Al, i added the line SomeDateField = Date() to the code i already had for
the email button. it works a treat ....thanks.

I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it. i can kind of picture the simple
code for this but not sure where to put it?

could you possibly help me (yet again)?

thanks
 
G

Guest

Hi Al, i entered the code below (not in the "on exit" as i first thought i
had to do) and it works great (i changed the and to or). However i would like
an error messgae to pop up so that the user knows why the email has not sent.

could you enlighten me with the commands that are used in display a meesage
Thanks Al, i could not think where to put the code. I will put it in "on
exit" as you suggest. Its obvious now you have said it.

thanks again

Al Campagna said:
Maax,
You actually solved your own problem with this "textual" statement...
I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it.
Just convert that same "logic" to an IF statement to exit the sub if any of those
conditions does not exist.

Private Sub SomeButton_Click()
If [Status] <> "Engineered" and IsNull([BOM]) and IsNull(Labour) Then
Exit Sub
End If
SomeDateField = Date()
' your code to send email here
End Sub

All 3 criteria must be met before the Date is set, and the Email sent...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Maax said:
Hi Al, i added the line SomeDateField = Date() to the code i already had for
the email button. it works a treat ....thanks.

I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it. i can kind of picture the simple
code for this but not sure where to put it?

could you possibly help me (yet again)?

thanks


:

Maax,
It would have been helpful if you had provided the names of the button and the date
field, so... I'll use my own names.
I'll also assume that the button and the date field are on the Main form...
Private Sub SomeButton_Click()
SomeDateField = Date()
' your code to send email here
End Sub
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Hello, i would like to have a date field update with the date that a button
is pressed. The button sends an email to a colleague to inform them that a
record is available for them to update with a price.
I will then create a report that will list the the records with the date i
sent the email and the date that the price is added and sent to the customer
(price sent is already a field within the form).

as usuall any help greatly appreciated.

regards
 
A

Al Campagna

Maax,
I didn't suggest the OnExit event, I suggested the OnClick event of the button...
Check out the MsgBox function, and insert your MsgBox just before the Exit Sub.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Maax said:
Hi Al, i entered the code below (not in the "on exit" as i first thought i
had to do) and it works great (i changed the and to or). However i would like
an error messgae to pop up so that the user knows why the email has not sent.

could you enlighten me with the commands that are used in display a meesage
Thanks Al, i could not think where to put the code. I will put it in "on
exit" as you suggest. Its obvious now you have said it.

thanks again

Al Campagna said:
Maax,
You actually solved your own problem with this "textual" statement...
I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it.
Just convert that same "logic" to an IF statement to exit the sub if any of those
conditions does not exist.

Private Sub SomeButton_Click()
If [Status] <> "Engineered" and IsNull([BOM]) and IsNull(Labour) Then
Exit Sub
End If
SomeDateField = Date()
' your code to send email here
End Sub

All 3 criteria must be met before the Date is set, and the Email sent...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Hi Al, i added the line SomeDateField = Date() to the code i already had for
the email button. it works a treat ....thanks.

I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it. i can kind of picture the simple
code for this but not sure where to put it?

could you possibly help me (yet again)?

thanks


:

Maax,
It would have been helpful if you had provided the names of the button and the
date
field, so... I'll use my own names.
I'll also assume that the button and the date field are on the Main form...
Private Sub SomeButton_Click()
SomeDateField = Date()
' your code to send email here
End Sub
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Hello, i would like to have a date field update with the date that a button
is pressed. The button sends an email to a colleague to inform them that a
record is available for them to update with a price.
I will then create a report that will list the the records with the date i
sent the email and the date that the price is added and sent to the customer
(price sent is already a field within the form).

as usuall any help greatly appreciated.

regards
 
G

Guest

Yeah i know you never said to put it in the "on exit" event. When i read your
reply initially i seen the word exit and jumped the gun a little.
All is working fine now. Many thanks.

Al Campagna said:
Maax,
I didn't suggest the OnExit event, I suggested the OnClick event of the button...
Check out the MsgBox function, and insert your MsgBox just before the Exit Sub.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

Maax said:
Hi Al, i entered the code below (not in the "on exit" as i first thought i
had to do) and it works great (i changed the and to or). However i would like
an error messgae to pop up so that the user knows why the email has not sent.

could you enlighten me with the commands that are used in display a meesage
Thanks Al, i could not think where to put the code. I will put it in "on
exit" as you suggest. Its obvious now you have said it.

thanks again

:

Maax,
You actually solved your own problem with this "textual" statement...
I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it.
Just convert that same "logic" to an IF statement to exit the sub if any of those
conditions does not exist.

Private Sub SomeButton_Click()
If [Status] <> "Engineered" and IsNull([BOM]) and IsNull(Labour) Then
Exit Sub
End If
SomeDateField = Date()
' your code to send email here
End Sub

All 3 criteria must be met before the Date is set, and the Email sent...
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Hi Al, i added the line SomeDateField = Date() to the code i already had for
the email button. it works a treat ....thanks.

I would like to have the button disabled if the STATUS field does not equal
"engineered" and the BOM field does not have a value in and finally the
LABOUR field does not have a value in it. i can kind of picture the simple
code for this but not sure where to put it?

could you possibly help me (yet again)?

thanks


:

Maax,
It would have been helpful if you had provided the names of the button and the
date
field, so... I'll use my own names.
I'll also assume that the button and the date field are on the Main form...
Private Sub SomeButton_Click()
SomeDateField = Date()
' your code to send email here
End Sub
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."


Hello, i would like to have a date field update with the date that a button
is pressed. The button sends an email to a colleague to inform them that a
record is available for them to update with a price.
I will then create a report that will list the the records with the date i
sent the email and the date that the price is added and sent to the customer
(price sent is already a field within the form).

as usuall any help greatly appreciated.

regards
 

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