Refresh Table Data Based On ComboBox (1 Viewer)

t0ny84

New member
Local time
Today, 23:55
Joined
Aug 3, 2021
Messages
3
Hi,

Sorry in advance if this doesn't make sense!

I am hoping someone can assist, I am currently building a Microsoft Access Database for my workplace to keep track of employees and their movements (e.g. Team Changes). I am trying to create an Employee Details Form like in the Student \ Time Card Microsoft Access Templates where I use a combo box to select from a list and once an employee is selected their details load in the fields on the form. I have tried importing this form and updating the source to my query but am unable to get the Embedded Macro to work. I am wondering if someone can please either explain how the Combo Box on the Templates are setup\work or alternatively what code (either Macro or Embedded Macro) could I use from scratch to have my form do the same.

Thanks in advance,
t0ny84
 

t0ny84

New member
Local time
Today, 23:55
Joined
Aug 3, 2021
Messages
3
Cross Post Links
mrexcel dot com/board/threads/refresh-table-data-based-on-combobox.1178079/
access-programmers dot co.uk/forums/threads/refresh-table-data-based-on-combobox.318905/
.accessforums dot net/showthread.php?t=84133&p=480705#post480705

I am asking this question on multiple forums as I'm not sure what is the best forum to get assistance with my question. It will also hopefully see assistance from different users which should give different solutions (multiple learning opportunities).

I tried to edit the original post but it wouldn't update as it saw the edit as spam.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:55
Joined
Jul 9, 2003
Messages
16,244
I think you're better off choosing and sticking to one forum. I seldom respond to cross posted questions because it just gets in hell of a mess!
 

Cotswold

Active member
Local time
Today, 12:55
Joined
Dec 31, 2020
Messages
521
You will need to look up Refresh, Requery, RePaint, RepaintObject and referring to Objects and Variables on a form in the Language Reference.

You need to understand how the syntax works, ie:

[Forms]![FormName].[Form]![VarName]
[Forms]![FormName].Requery
[Forms]![FormName]![VarName]
[Forms]![MainForm]![SubForm].Form!FieldName.Refresh
[Forms]![MainForm]![SubForm].Form.Requery

You can activate these from a button or any form event. For instance OnCurrent , OnChange, OnClick.....etc.
Personally, I find OnDoubleClick particularly handy to use for doing so many things. With that you can open
forms, run re-calcs and a multitude of other actions, including updating a Combo Box. I have DoubleClick
events scattered through most of my forms. As far as any of my users are concerned they all know from the
manuals on any form : If in doubt Double-Click. It will so often give them a result and also saves screen
space where a button may be the more usual option. However, a refresh button with the code you need to
fix your combo issue on your form may well be the obvious option for your program. Clicking on that could
do everything that you need and more.

Personally I never use Macros, embedded or otherwise.
I will only use Function() Or Sub(). Build your own library of standard functions in Modules which you can copy
from program to program.

No point in doing it all for you, it won't help in the understanding. I'd advise you to read through the Language Reference. Might be a bit boring but is essential at some stage. You'll soon be sorting out your combo boxes I'm sure.
 
Last edited:

t0ny84

New member
Local time
Today, 23:55
Joined
Aug 3, 2021
Messages
3
Hey Costwold,
Thank you for the guidance, will definitely look into these. I usually only deal with Excel so am happy for any information suggests

To anyone looking at this thread for guidance - a VBA solution has been provided at:

accessforums DOT net/showthread.php?t=84133&p=480712#post480712
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:55
Joined
Feb 19, 2002
Messages
42,970
I have tried importing this form
Importing the form from where? Another Access application? If it is just the find macro that isn't working, delete the combo completely and create a new one. Access will prompt you and rebuild it based on the current version of the form.

I don't ever use embedded macros. They are way too hard to change and frankly, macro logic is bizarre to someone who knows how to code.

If you want to change what you have rather than let the wizard build a new one, open the form in design view and press the button to convert macros. You can then post the VBA code and we'll help you figure out the problem.
 

Users who are viewing this thread

Top Bottom