Seriously don't have a clue on what to do. (1 Viewer)

seeker9969

New member
Local time
Today, 14:59
Joined
Jan 25, 2020
Messages
23
I am new to this here fine blog, I am not real familiar with where to post what? I have a question on how to get a combo box on the after update pick from one table and save it to another table. So where would I post this or how would I know this has already not been addressed some where else.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:59
Joined
Aug 30, 2003
Messages
36,127
I've moved this to the forms forum. A combo can get its values from one table, via the row source property, and save to another table, based on its control source property. That would mean the form would be bound to the second table (record source property).
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:59
Joined
Feb 19, 2013
Messages
16,627
have a question on how to get a combo box on the after update pick from one table and save it to another table. So where would I post this
you're in the right section of the forum - Edit, because paul has moved it:)
how would I know this has already not been addressed some where else.
look to the bottom of your thread for similar threads - these are found based on the title of your thread
 

seeker9969

New member
Local time
Today, 14:59
Joined
Jan 25, 2020
Messages
23
Pbaldy was spot on and gave me the answer. thank yor for that. but it revealed another bug that i have to over come. I want the combo box to remain with the chosen data until I want it remove the data from the table. I know combo boxes are not designed to do that. so I am looking for a work around. Like hiding combo box after update and unhiding a text box with the answer. Any thoughts???
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:59
Joined
Aug 30, 2003
Messages
36,127
Pbaldy was spot on and gave me the answer. thank yor for that.

Happy to help. I'm a little confused, you don't want the user to be able to change the selection once one is made? You could just lock the combo in its after update event. You'd probably want to unlock it in the current event if it's empty. This type of thing, but checking whether a selection has been made:

 

seeker9969

New member
Local time
Today, 14:59
Joined
Jan 25, 2020
Messages
23
I am fine with the user changing the information in the cbobox but what i dont want is it cleared out of the box by closing a form close or a refresh or closing the database. I will be using a delete query to remove the data out of the tables then those boxes will be empty
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:59
Joined
Aug 30, 2003
Messages
36,127
Have you had that experience? Presuming it's bound to a table/field as described above, once saved it won't be cleared out by those methods. A bound form/control automatically attempts to save with you close the form.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:59
Joined
Feb 19, 2013
Messages
16,627
are you talking about saving the last selection made in the combobox? so you can 'come back to it later'?

If so, then you need to use vba code in the form close event to update the combo default value and save the form.

Alternative (again vba code) is to save the latest value to a table somewhere when the form is closed and when the form is opened, it interrogates that table to repopulate the default value
 

seeker9969

New member
Local time
Today, 14:59
Joined
Jan 25, 2020
Messages
23
I guess I am not fully understanding your point, when I put a name in the cbobox its there and when I close the form the data is written to the table but the cbobox come up empty upon reload. I have the form bound to a table (the table I want the data written too) and the control source is connected to a field in the table written too and row source is connected to the table i am getting the data from. It works great I am happy with that. Now when i reload they cboboxes are empty, which is I think is normal. I think LOL.
 
Last edited:

seeker9969

New member
Local time
Today, 14:59
Joined
Jan 25, 2020
Messages
23
Ok CJLondon that makes sense I had planned on setting it up on the after update of the cbobox to docmd.save which works nicely I had thought of having a txt box sitting over the cbobox and on the after update bring it forward so it shows the text box which is linked to the table with the stored data. Now I got to learn how to move a txtbox forward or backwarsds or hide or unhide. have any thoughts can I move a txt box forward or backwards?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:59
Joined
Feb 19, 2013
Messages
16,627
I don't know what you mean by moving a text box forwards or backwards and has nothing to do with setting a default on a combobox. Think it is time you showed some screenshots of what you are trying to achieve.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:59
Joined
May 21, 2018
Messages
8,552
Please upload as an attached file. Most people will not look at offsite folders and file sharing sites. Zip it first.
 

seeker9969

New member
Local time
Today, 14:59
Joined
Jan 25, 2020
Messages
23
So in all my attempts to try and achieve with the whole hiding buttons thing I have now abandoned. I could not get it to work. will some one tell me what i have to change to get the cbobox to write the name in the saved players table in instead of the ID
 

Attachments

  • score keeping.zip
    90.4 KB · Views: 51

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:59
Joined
May 21, 2018
Messages
8,552
A combobox has a bound column. Your rowsource is
SELECT fldPlayersID, fldPlayers FROM tblPlayers ORDER BY fldPlayers;
You have two columns and you are bound to 1
BoundColumn:1
should be
BoundColumn:2

Not sure of the design, I would do it different. But that is the reason.
 

seeker9969

New member
Local time
Today, 14:59
Joined
Jan 25, 2020
Messages
23
Ok cool thanks MajP I knew it was something so simple. i went and tried changing the queries with no luck. I realize the dbase is in rough form but I am open to good ideas if yant to share with me.
 

Users who are viewing this thread

Top Bottom