Remove autosave from field and reqiure a save button

  • Thread starter Thread starter T.Banks
  • Start date Start date
T

T.Banks

How do I change the records autosave in a form to a "save button" at the
bottom of the form. I do not want users to input only a few fields and then
exit. I understand I can "require" input in certain fields but there are
some fields I do not want to require. I don't want a user to fill out a
couple of fields and then decide to exit which will save unwanted records.
Thanks/
 
How do I change the records autosave in a form to a "save button" at the
bottom of the form. I do not want users to input only a few fields and then
exit. I understand I can "require" input in certain fields but there are
some fields I do not want to require. I don't want a user to fill out a
couple of fields and then decide to exit which will save unwanted records.
Thanks/

Put some code in the Form's BeforeUpdate event to check for the needed fields,
and set Cancel to true if the record isn't complete. Sample code might be

Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
If IsNull(Me!ThisTextbox) Or IsNull(Me!ThatTextbox) Then
iAns = MsgBox("The form isn't complete! Do you want to cancel?", vbYesNo)
If iAns = vbYes Then
Me.Undo ' erase the form and start over
End If
Cancel = True ' in either case, cancel writing to disk
End If
End Sub
 
Thanks so much. This forum is great for someone like me who doesn't know
much about Access and writing codes.
 
Two More Questions. Question #1. I am developing a database for tool
inventories at a correctional facility and the staff in each department will
enter their tool information. I created a combo box that lists the class of
tools – “AA – Extremely Dangerousâ€, “A – Dangerousâ€, etc. How do I add a
button next to this combo box which will display a word or excel document
that describes the classes of tools in further detail? Question #2. Is there
a code building program, book, or reference that is good for “Dummies� I’ve
learned what I know about Access 2007 from “Step By Step – Access 2007†by
Steve Lambert, M. Dow Lambert III, and Joan Preppernau and “Access 2007 for
Dummiesâ€. Great books – I’ve learned a lot but I found out, once I started
building a database from scratch, that I’ve got a long way to go and a lot to
learn. Thanks/
 
Two More Questions. Question #1. I am developing a database for tool
inventories at a correctional facility and the staff in each department will
enter their tool information. I created a combo box that lists the class of
tools – “AA – Extremely Dangerous”, “A – Dangerous”, etc. How do I add a
button next to this combo box which will display a word or excel document
that describes the classes of tools in further detail?

Wow. That's getting QUITE advanced!

The simplest way might be to put a Hyperlink field in your table with a link
to the external document. Put a textbox on the form next to the combo, with
its control source set to

=DLookUp("[thehyperlinkfieldname]", "[tablename]", "[Hazardlevel] = " &
comboboxname)

with appropriate name tweaking of course. The user can then doubleclick on the
hyperlink to open the document.
Question #2. Is there
a code building program, book, or reference that is good for “Dummies”? I’ve
learned what I know about Access 2007 from “Step By Step – Access 2007” by
Steve Lambert, M. Dow Lambert III, and Joan Preppernau and “Access 2007 for
Dummies”. Great books – I’ve learned a lot but I found out, once I started
building a database from scratch, that I’ve got a long way to go and a lot to
learn. Thanks/

There is a wealth of resources, books, etc. available. Here are some starting
points:

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP):
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials
 
Here's my code:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim iAns As Integer
If IsNull(Me!cboCategory) Or IsNull(Me!Combo17) Then
iAns = MsgBox("The form isn't complete! Do you want to cancel?", vbYesNo)
If iAns = vbYes Then
Me.Undo ' erase the form and start over
End If
Cancel = True ' in either case, cancel writing to disk
End If
End Sub

How do I stop the automatic error message "You can't save this record at
this time?"

--
T.Banks


John W. Vinson said:
Two More Questions. Question #1. I am developing a database for tool
inventories at a correctional facility and the staff in each department will
enter their tool information. I created a combo box that lists the class of
tools – “AA – Extremely Dangerousâ€, “A – Dangerousâ€, etc. How do I add a
button next to this combo box which will display a word or excel document
that describes the classes of tools in further detail?

Wow. That's getting QUITE advanced!

The simplest way might be to put a Hyperlink field in your table with a link
to the external document. Put a textbox on the form next to the combo, with
its control source set to

=DLookUp("[thehyperlinkfieldname]", "[tablename]", "[Hazardlevel] = " &
comboboxname)

with appropriate name tweaking of course. The user can then doubleclick on the
hyperlink to open the document.
Question #2. Is there
a code building program, book, or reference that is good for “Dummies� I’ve
learned what I know about Access 2007 from “Step By Step – Access 2007†by
Steve Lambert, M. Dow Lambert III, and Joan Preppernau and “Access 2007 for
Dummiesâ€. Great books – I’ve learned a lot but I found out, once I started
building a database from scratch, that I’ve got a long way to go and a lot to
learn. Thanks/

There is a wealth of resources, books, etc. available. Here are some starting
points:

Jeff Conrad's resources page:
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page:
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP):
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials:
http://allenbrowne.com/links.html#Tutorials
 
Here's my code:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim iAns As Integer
If IsNull(Me!cboCategory) Or IsNull(Me!Combo17) Then
iAns = MsgBox("The form isn't complete! Do you want to cancel?", vbYesNo)
If iAns = vbYes Then
Me.Undo ' erase the form and start over
End If
Cancel = True ' in either case, cancel writing to disk
End If
End Sub

How do I stop the automatic error message "You can't save this record at
this time?"

Under what circumstances do you get this message??? You shouldn't, I wouldn't
expect!

YOu might watn to add a line

Me.cboCategory.SetFocus

after the Cancel = True line, but I don't think that will affect the error
message.
 
Back
Top