2 questions 1 on update, 1 on last update date

G

Guest

Hi all...

Question #1

I have an add new/delete/close form button at the bottom of the form.
What I would like to add is an update button. Some of the fields will be
updated for the record that is currently being displayed. But if someone
changes the dollor amount or checks one of the boxes I would like for them to
push an update button and have it update the record in the table. So next
time the come back to the record it will be updated with the information they
just put in. How can I do this?

Question #2

I have a field in my tblMain that is named [LastUpdated]. I also have the
current date being displayed on the form via the =date(). What I would to be
able to do.. Is when they hit the update button it puts the current date
[LastUpdated] field in the table. So when the person comes back to the
record they can see when it was last updated. How would I do this?

Thanks
R~
 
G

Guest

Ok I figured out the update button... but how do I get it to put a date in
the update field in the tblMain?

Thanks
R~
 
G

Guest

Its depend on the approach you are using with the update button.

If the text fields in the form are bound to the table, then if you have the
LastUpdated field in the form, then you can write before you save the record

Me.[LastUpdated] = Date()

--
Good Luck
BS"D


Rhett_Y said:
Ok I figured out the update button... but how do I get it to put a date in
the update field in the tblMain?

Thanks
R~

Rhett_Y said:
Hi all...

Question #1

I have an add new/delete/close form button at the bottom of the form.
What I would like to add is an update button. Some of the fields will be
updated for the record that is currently being displayed. But if someone
changes the dollor amount or checks one of the boxes I would like for them to
push an update button and have it update the record in the table. So next
time the come back to the record it will be updated with the information they
just put in. How can I do this?

Question #2

I have a field in my tblMain that is named [LastUpdated]. I also have the
current date being displayed on the form via the =date(). What I would to be
able to do.. Is when they hit the update button it puts the current date
[LastUpdated] field in the table. So when the person comes back to the
record they can see when it was last updated. How would I do this?

Thanks
R~
 
G

Guest

I was so close.. and yup that worked perfetcly.......

What I did is create a save button (it works don't know if it is right
thou.. checked ok on the updates in the main table)... then in the vb code
put your code and it works like a charm... I changed it to now so I can get
the time in there too!!!

If I did the button part wrong can you let me know if I should be doing it a
better way...

Thanks a bunch.......
R~

Ofer Cohen said:
Its depend on the approach you are using with the update button.

If the text fields in the form are bound to the table, then if you have the
LastUpdated field in the form, then you can write before you save the record

Me.[LastUpdated] = Date()

--
Good Luck
BS"D


Rhett_Y said:
Ok I figured out the update button... but how do I get it to put a date in
the update field in the tblMain?

Thanks
R~

Rhett_Y said:
Hi all...

Question #1

I have an add new/delete/close form button at the bottom of the form.
What I would like to add is an update button. Some of the fields will be
updated for the record that is currently being displayed. But if someone
changes the dollor amount or checks one of the boxes I would like for them to
push an update button and have it update the record in the table. So next
time the come back to the record it will be updated with the information they
just put in. How can I do this?

Question #2

I have a field in my tblMain that is named [LastUpdated]. I also have the
current date being displayed on the form via the =date(). What I would to be
able to do.. Is when they hit the update button it puts the current date
[LastUpdated] field in the table. So when the person comes back to the
record they can see when it was last updated. How would I do this?

Thanks
R~
 
G

Guest

Because all the fields in the form are bound to the fields in the table the
save will do the job.
About the time you can use
Me.[LastUpdated] = Now()
=====================
But you have to know that the changes will be saved regardless if you press
the save button, the second you exit the form or move to another record, the
record will be saved.

--
Good Luck
BS"D


Rhett_Y said:
I was so close.. and yup that worked perfetcly.......

What I did is create a save button (it works don't know if it is right
thou.. checked ok on the updates in the main table)... then in the vb code
put your code and it works like a charm... I changed it to now so I can get
the time in there too!!!

If I did the button part wrong can you let me know if I should be doing it a
better way...

Thanks a bunch.......
R~

Ofer Cohen said:
Its depend on the approach you are using with the update button.

If the text fields in the form are bound to the table, then if you have the
LastUpdated field in the form, then you can write before you save the record

Me.[LastUpdated] = Date()

--
Good Luck
BS"D


Rhett_Y said:
Ok I figured out the update button... but how do I get it to put a date in
the update field in the tblMain?

Thanks
R~

:

Hi all...

Question #1

I have an add new/delete/close form button at the bottom of the form.
What I would like to add is an update button. Some of the fields will be
updated for the record that is currently being displayed. But if someone
changes the dollor amount or checks one of the boxes I would like for them to
push an update button and have it update the record in the table. So next
time the come back to the record it will be updated with the information they
just put in. How can I do this?

Question #2

I have a field in my tblMain that is named [LastUpdated]. I also have the
current date being displayed on the form via the =date(). What I would to be
able to do.. Is when they hit the update button it puts the current date
[LastUpdated] field in the table. So when the person comes back to the
record they can see when it was last updated. How would I do this?

Thanks
R~
 
G

Guest

Oh.. Even thou I have it under the click option of the "save" button? If
this is the case, what would I need to do in order for it to only save AFTER
someone clicks the save button? I don't want it to be everytime you exit the
application? Or will this work the way I have it?

R~

Ofer Cohen said:
Because all the fields in the form are bound to the fields in the table the
save will do the job.
About the time you can use
Me.[LastUpdated] = Now()
=====================
But you have to know that the changes will be saved regardless if you press
the save button, the second you exit the form or move to another record, the
record will be saved.

--
Good Luck
BS"D


Rhett_Y said:
I was so close.. and yup that worked perfetcly.......

What I did is create a save button (it works don't know if it is right
thou.. checked ok on the updates in the main table)... then in the vb code
put your code and it works like a charm... I changed it to now so I can get
the time in there too!!!

If I did the button part wrong can you let me know if I should be doing it a
better way...

Thanks a bunch.......
R~

Ofer Cohen said:
Its depend on the approach you are using with the update button.

If the text fields in the form are bound to the table, then if you have the
LastUpdated field in the form, then you can write before you save the record

Me.[LastUpdated] = Date()

--
Good Luck
BS"D


:

Ok I figured out the update button... but how do I get it to put a date in
the update field in the tblMain?

Thanks
R~

:

Hi all...

Question #1

I have an add new/delete/close form button at the bottom of the form.
What I would like to add is an update button. Some of the fields will be
updated for the record that is currently being displayed. But if someone
changes the dollor amount or checks one of the boxes I would like for them to
push an update button and have it update the record in the table. So next
time the come back to the record it will be updated with the information they
just put in. How can I do this?

Question #2

I have a field in my tblMain that is named [LastUpdated]. I also have the
current date being displayed on the form via the =date(). What I would to be
able to do.. Is when they hit the update button it puts the current date
[LastUpdated] field in the table. So when the person comes back to the
record they can see when it was last updated. How would I do this?

Thanks
R~
 
G

Guest

You can use something like

Private Sub Form_BeforeUpdate(Cancel As Integer)
' Check if there are any changes in the data
If Me.Dirty Then
If MsgBox("Do you want to save the changes?", vbYesNo) = vbNo Then
' Undo all the changes
Me.Undo
End If
End If
End Sub

either on the Unload event of the form, or on the before update event.

--
Good Luck
BS"D


Rhett_Y said:
Oh.. Even thou I have it under the click option of the "save" button? If
this is the case, what would I need to do in order for it to only save AFTER
someone clicks the save button? I don't want it to be everytime you exit the
application? Or will this work the way I have it?

R~

Ofer Cohen said:
Because all the fields in the form are bound to the fields in the table the
save will do the job.
About the time you can use
Me.[LastUpdated] = Now()
=====================
But you have to know that the changes will be saved regardless if you press
the save button, the second you exit the form or move to another record, the
record will be saved.

--
Good Luck
BS"D


Rhett_Y said:
I was so close.. and yup that worked perfetcly.......

What I did is create a save button (it works don't know if it is right
thou.. checked ok on the updates in the main table)... then in the vb code
put your code and it works like a charm... I changed it to now so I can get
the time in there too!!!

If I did the button part wrong can you let me know if I should be doing it a
better way...

Thanks a bunch.......
R~

:

Its depend on the approach you are using with the update button.

If the text fields in the form are bound to the table, then if you have the
LastUpdated field in the form, then you can write before you save the record

Me.[LastUpdated] = Date()

--
Good Luck
BS"D


:

Ok I figured out the update button... but how do I get it to put a date in
the update field in the tblMain?

Thanks
R~

:

Hi all...

Question #1

I have an add new/delete/close form button at the bottom of the form.
What I would like to add is an update button. Some of the fields will be
updated for the record that is currently being displayed. But if someone
changes the dollor amount or checks one of the boxes I would like for them to
push an update button and have it update the record in the table. So next
time the come back to the record it will be updated with the information they
just put in. How can I do this?

Question #2

I have a field in my tblMain that is named [LastUpdated]. I also have the
current date being displayed on the form via the =date(). What I would to be
able to do.. Is when they hit the update button it puts the current date
[LastUpdated] field in the table. So when the person comes back to the
record they can see when it was last updated. How would I do this?

Thanks
R~
 
G

Guest

Ofer...

That worked perfectaly.!!!! Thanks a bunch... I have it all working
now..!!

Thanks
R~

Ofer Cohen said:
You can use something like

Private Sub Form_BeforeUpdate(Cancel As Integer)
' Check if there are any changes in the data
If Me.Dirty Then
If MsgBox("Do you want to save the changes?", vbYesNo) = vbNo Then
' Undo all the changes
Me.Undo
End If
End If
End Sub

either on the Unload event of the form, or on the before update event.

--
Good Luck
BS"D


Rhett_Y said:
Oh.. Even thou I have it under the click option of the "save" button? If
this is the case, what would I need to do in order for it to only save AFTER
someone clicks the save button? I don't want it to be everytime you exit the
application? Or will this work the way I have it?

R~

Ofer Cohen said:
Because all the fields in the form are bound to the fields in the table the
save will do the job.
About the time you can use
Me.[LastUpdated] = Now()
=====================
But you have to know that the changes will be saved regardless if you press
the save button, the second you exit the form or move to another record, the
record will be saved.

--
Good Luck
BS"D


:

I was so close.. and yup that worked perfetcly.......

What I did is create a save button (it works don't know if it is right
thou.. checked ok on the updates in the main table)... then in the vb code
put your code and it works like a charm... I changed it to now so I can get
the time in there too!!!

If I did the button part wrong can you let me know if I should be doing it a
better way...

Thanks a bunch.......
R~

:

Its depend on the approach you are using with the update button.

If the text fields in the form are bound to the table, then if you have the
LastUpdated field in the form, then you can write before you save the record

Me.[LastUpdated] = Date()

--
Good Luck
BS"D


:

Ok I figured out the update button... but how do I get it to put a date in
the update field in the tblMain?

Thanks
R~

:

Hi all...

Question #1

I have an add new/delete/close form button at the bottom of the form.
What I would like to add is an update button. Some of the fields will be
updated for the record that is currently being displayed. But if someone
changes the dollor amount or checks one of the boxes I would like for them to
push an update button and have it update the record in the table. So next
time the come back to the record it will be updated with the information they
just put in. How can I do this?

Question #2

I have a field in my tblMain that is named [LastUpdated]. I also have the
current date being displayed on the form via the =date(). What I would to be
able to do.. Is when they hit the update button it puts the current date
[LastUpdated] field in the table. So when the person comes back to the
record they can see when it was last updated. How would I do this?

Thanks
R~
 

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