Navigation Button concern/problem (2 Viewers)

emina002

Registered User.
Local time
Today, 20:07
Joined
Jan 19, 2019
Messages
15
Hello there,

Just a quick introduction to myself, I am Emina002(username), and my current role was being a VBA Developer in Excel, I am really want to learn more about on VBA Access. I already developed some system using MS Access.

Right now, I am working on a project which gave me a hard time, On my project, I am actually using navigation form, Each navigation button has a different subform bound to it. Now I am noticing when I am transferring or click another Navigation button, the data I entered on the first subform is cleared(when I get back to that navigation button), Is there any way I can make it maintain the data I entered?

This is the first time I will use Navigation Form on MS Access so I am not really familiar if the solution to my problem would be possible.

PS: Pardon for the language barrier. Let me know if you have still a question regarding my problem.
 

Micron

AWF VIP
Local time
Today, 08:07
Joined
Oct 20, 2018
Messages
3,478
Is there any way I can make it maintain the data I entered?
Likely that data was saved (check to be sure). However, a nav form can only load one form at a time. When you switch forms, the one you were looking at closes. One reason why it's not popular with seasoned developers.
 

emina002

Registered User.
Local time
Today, 20:07
Joined
Jan 19, 2019
Messages
15
Hi Micron, I really appreciate your response on my thread, however, I am using unbound controls(corrected me if I am wrong that this control not bound to the database), some of the controls are usually combo box and 1 list box, and 5 textboxes.

Since it was unbound control, would it still be possible?
 

isladogs

MVP / VIP
Local time
Today, 13:07
Joined
Jan 14, 2017
Messages
18,211
In a bound form, data is saved automatically.
As you are using unbound controls, data is only saved if you explicitly save it.
If you move away from an unbound subform and back again, the controls will indeed be empty on return.

Suggest you create your own standard form and subforms instead of a navigation form.
Strongly recommend you use bound forms and save yourself a lot of unecessary work.
 

Micron

AWF VIP
Local time
Today, 08:07
Joined
Oct 20, 2018
Messages
3,478
Are you sure you need the controls to be unbound? It complicates things.
If unbound, then you will have to write code to write all the form values to the table(s) involved. Alternatively, you could use an append query that gets the values from those controls and either run it via code or a macro. Then there is the difficulty of dealing with whether or not user is creating a new record or editing one. If editing, it's an update query, not append. Maybe you should explain why the controls are not bound. There may be a better way.
 

emina002

Registered User.
Local time
Today, 20:07
Joined
Jan 19, 2019
Messages
15
Hi Micron, your opinion makes sense to me now. I used unbound control because I set some condition on some controls. Maybe I am not really familiar about append and update query yet.

Thanks anyway.
 

Micron

AWF VIP
Local time
Today, 08:07
Joined
Oct 20, 2018
Messages
3,478
Controls don't need to be unbound to set conditions on what's put in to them.
 

June7

AWF VIP
Local time
Today, 04:07
Joined
Mar 9, 2014
Messages
5,468
Is the form bound (has RecordSource) and some controls are bound and some are not?
 

emina002

Registered User.
Local time
Today, 20:07
Joined
Jan 19, 2019
Messages
15
@June7, regarding to your question, the form I am using, recordsource connected to the tables, but the controls are unbound most,

The form with recordsource, is within the navigationsubform, so I can't configure how to change the controls to unbound to bound.
 

isladogs

MVP / VIP
Local time
Today, 13:07
Joined
Jan 14, 2017
Messages
18,211
@emina
I answered some of these questions back in post #4 but you may have missed that.
Even if the form is bound, having unbound controls will mean it behaves as I described.
You should create your own bound forms & controls and get rid of the navigation form which rarely works well with more than one subform
 
Last edited:

emina002

Registered User.
Local time
Today, 20:07
Joined
Jan 19, 2019
Messages
15
@IslaDogs, apologize if I didn't notice your response on this thread. My client just wants it that way(navigation control), but if there would be a suggestion, should I suggest to used tab control instead? Do you think guys It will work now? Thank you.
 

isladogs

MVP / VIP
Local time
Today, 13:07
Joined
Jan 14, 2017
Messages
18,211
Hi
A tab control is a very good way of displaying multiple subforms on a same form.
Much easier to code as well
 

emina002

Registered User.
Local time
Today, 20:07
Joined
Jan 19, 2019
Messages
15
Thanks, @isladogs, I will suggest that to my client, I started the project with tabs control, but I was amazed at how the navigation form works. Maybe I switch it back using tabs control again.
 

isladogs

MVP / VIP
Local time
Today, 13:07
Joined
Jan 14, 2017
Messages
18,211
The built in navigation form seems very attractive especially to new users.
However if you try and modify them in any significant way they are an utter PITA to code.
As I think Micron wrote earlier, most developers use them rarely or not at all - I'm in the 'not at all' group

BTW similar comments apply to the built in split form. Avoid them as well

Coming back to my previous comments, whichever form you use, there are very few good reasons for having unbound controls.
 

June7

AWF VIP
Local time
Today, 04:07
Joined
Mar 9, 2014
Messages
5,468
I also have never used the Navigation form. I have used Split form in a very simple db with none or little code.

Regardless of the form type, saving data from UNBOUND controls requires code.

An advantage of Navigation form is apparently quick load whereas a Tab control with a lot of subforms can be noticeably slow when form first opens (I have one like this). One way to handle is to not load the subforms until the Tab page first gets focus. An UNBOUND control will retain value until form is closed, which is why this does not work on Navigation form because forms are loaded and removed when navigating the tabs.
 

Users who are viewing this thread

Top Bottom