Hold value in combo box and list box after record entered (1 Viewer)

Obe

Registered User.
Local time
Yesterday, 18:49
Joined
Apr 3, 2012
Messages
18
I am a beginner user in MSAccess and VBA code. I'm developing a form for data entry.

I'm using a combo box to select a Task from a table and a cascaded list box to select the Elements from a query based on the selected Task. I have a text box to enter Standards for the selected Element. When the new record is entered into the Standards table, the TaskID and ElementID are also entered into the Standards Table. This is fine, but every time a new record is entered, I have to reselect the Task and Element to enter the next Standard. As there may be more than one Standard for an element, I want the Task with associated TaskID and the Element with associated ElementID to remain until a new Task or a new Element is selected.

How can I maintain the value in the combo box and list box while entering the Standard record?

db example attached.
 
Last edited:

Mr. B

"Doctor Access"
Local time
Yesterday, 20:49
Joined
May 20, 2009
Messages
1,932
Attached is a modified version of your database.

Take a look at the changes made to the form and the VBA code behind the OnCurrent event of the form and the After Update event of the other controls.

Hope this helps get you going.
 

Attachments

  • JTA db Help.zip
    63.8 KB · Views: 118

Obe

Registered User.
Local time
Yesterday, 18:49
Joined
Apr 3, 2012
Messages
18
Many Thanks Mr. B,
That will get me started. I'll need to play with the code a bit as the Add Standard button is not available after entering a Standard unless I reselect the Task. But I get the idea and will repost here if I get it to work. That's how I'll learn!
 

Obe

Registered User.
Local time
Yesterday, 18:49
Joined
Apr 3, 2012
Messages
18
Mr. B,
I just realized that if I use the Enter key after entering the Standard the code works just fine. Its a lot cleaner your way!

Thanks again!
 

Mr. B

"Doctor Access"
Local time
Yesterday, 20:49
Joined
May 20, 2009
Messages
1,932
I was just about to post a response to your post about the behavior but then I saw your last posting.

Glad you gave it a try.

Actually there are several things that you can do with the form to make it function exactly as you want, but I just wanted to provide enough assistance to get you started.

Search here or post back when you have questions.
 

Users who are viewing this thread

Top Bottom