reset form after record entered!

razorking

Registered User.
Local time
Today, 13:45
Joined
Aug 27, 2004
Messages
332
I am sure this is simple but I am missing it so...

I have a form that is designed for data entry. I have a combo box on the form to select a value. Selecting a value prefills most of the other fields on the form with the most common values for the value selected (by using the cloneRecordSet VBA). The user then will use a scanner to enter a serial number to the record and enter the record.


I have designed the form so when it opens all of the fields are empty (by using a default value, weird methodology but it works). Once the combo box value is selected the pre-fill takes place.
The Problem:
After I enter the rcord I would the form to reset the combo box to the default value and thereby, hopefully, also reset all of the other fields to blank. My goal is to force the user to re-select a value from the combo box each time so as to avert possible data entry errors.

Please see attached sample database.

Thank You!
 

Attachments

Last edited:
On the AfterUpdate event of the part the user enters, set the combo box to "". You might have to copy your code under the combo box and set them all blank also.

Make sense?
 
baldeagle said:
On the AfterUpdate event of the part the user enters, set the combo box to "". You might have to copy your code under the combo box and set them all blank also.

Make sense?

I guess not. I am still not seeing it.

My problem is when I come up against a wall I cannot stop thinking about it until a solution is found, consequently I am spending way to much time on this issue.

I still do not see how to make the ComboBox value reset to the default value after entering the new record??
 
the forms AfterUpdate event is fired after the record is written to the db, so this is where any reset type of code usually goes.

So in this sub you would clear the combo box, and run the code to set the fields to empty.

thinking about if the defualt value is nothing in the first place then I'm not sure why creating a new record isn't setting them back to nothing. How is your combo box prefilling the form??
 
The ComboBox is prefilling the other fields on the form via the following VBA:

Private Sub Combo14_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[UnitType] = '" & Me![Combo14] & "'"
Me.Bookmark = rs.Bookmark
End Sub

I'm sure the problem has more to do with my wierd design then anything else. Nevertheless, I feel that it is close to being what I want/need but the darn fields need to somehow reset to blank after a record is entered. Otherwise data entry errors are sure to follow.
 
Pre-Fill vs. Find Record

The code that you posted just selects a specific record. If want everything to be cleared paste:
Code:
On Error GoTo Err_btnSave_Click
    DoCmd.GoToRecord , , acNewRec

Exit_btnSave_Click:
    Exit Sub

Err_btnSave_Click:
    MsgBox Err.Description
    Resume Exit_btnSave_Click

Into the afterupdate of the last thing to be updated (or if you have a 'save' btn, put it in after the save has happened)
 

Users who are viewing this thread

Back
Top Bottom