• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 842
  • Last Modified:

MS ACCESS SAVE + CLEAR FORM

Hi I have the database attached

In the MetricCollectionListBox form I'm trying to save and clear all fields however it seems to work partially. As soon as I do another record by selecting another division it goes back to the previous record and if I do it the second time then it starts with a new record.
MetricDatabaseFormStartupForm.accdb
0
FAH_
Asked:
FAH_
  • 4
  • 2
  • 2
2 Solutions
 
als315Commented:
All fields on your form are bounded. You are not obliged to save anything when you go to new record. Remove DoCmd.RunCommand acCmdSaveRecord.
If you like to select existing record, add unbounded field and add filter by this value.
0
 
FAH_Author Commented:
Even when I remove the acCmdSaveRecord is still doing the same thing i.e. It clears all the fields however when I try to select a division from the drop down it goes to the previous record and when i select it again the divison changes however all the other fields don't
0
 
Jeffrey CoachmanCommented:
Then we need to really clarify what you mean by:
"save and clear all fields", ..."

When you create a new record, you select values from all of the comboboxes and enter values in all of the textboxes.
Then simply move to the next (or new) record.
At that point you are in a new record, ...and all the controls should be blank.
Then start over with this new record.

In your form (on the combobox after Update events) you are "clearing" other comboboxes, ...but also, Requerying the combobox itself, ...*then requerying the form*

Why are you requerying the combobox and then the form?
The Form requery is what is throwing you back to the first record.

In a normal situation like this (bound controls) there is no need for any code on the after update event of the combobox.

So you will have to explain why you have this code on your comboboxes...

JeffCoachman
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
FAH_Author Commented:
The requerying is done to bring in other values based on first selection for example if someone selects 311 then only the services / activity / sub activity related to 311 can be selected only.
0
 
Jeffrey CoachmanCommented:
Then, as far as I can tell, you still don't need the Form Requery (me.requery)
...again, this is ultimately what is slamming you back to the first record...
0
 
FAH_Author Commented:
Thanks that solved that issue...


Secondly How can I retrieve all the information stored in the table if the user selects a certain div / service/ activity

I have entered the information and press the save / refresh button and it has saved all the info yet when I enter the div service activty combination I'm still getting the blank fields.
0
 
als315Commented:
If your fields are based on queries, you can requery each field separately.
Me.MyComboBox.requery
0
 
FAH_Author Commented:
i DIDN'T
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now