UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Requery Of Combox Box Issue, Access 2007    
 
   
Leah
post May 19 2017, 11:28 AM
Post#1



Posts: 670
Joined: 22-February 00
From: New York, New York


My combo box lists document names and returns the unique row that corresponds. If I change the name or add a new document row I want the list to update.

First I tried:

Private Sub Document_Name_AfterUpdate()

Me.cmbdocument.Requery

End Sub

That did not work.

Then I tried

Private Sub Document_Name_AfterUpdate()

Me.Requery

Me.cmbdocument.Requery

End

That worked however it goes back to tab 0. Document_Name is on tab one and I want it to go to tab two.

Then I figured that I really don't need to requery everything unless I need a different value in the combo box

I tried:

Private Sub cmbdocument_Click()

Me.Requery

Me.cmbdocument.Requery

End Sub

That does absolutely nothing.

I would be happy if I could get it to go to tab 2 when I click out instead of tab 1 which is the primary key which is an auto number. Actually I want it to remember the field I am on and go to the next one when I click out instead of going to tab 0 as there are other fields changes where I need to update the combo box.

Anyway I am probably not taking the best approach. Please advise.

Thanks

Leah
This post has been edited by Leah: May 19 2017, 11:37 AM

--------------------
Leah A. Kopel
Go to the top of the page
 
mike60smart
post May 19 2017, 12:49 PM
Post#2


UtterAccess VIP
Posts: 12,316
Joined: 6-June 05
From: Dunbar,Scotland


Hi Leah

Not really following what it is you are trying to achieve.

Are you trying to filter the form to show the Record that you select in the Combobox??


Can you upload a zipped copy of the Db?


--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
doctor9
post May 19 2017, 12:51 PM
Post#3


UtterAccess Editor
Posts: 17,850
Joined: 29-March 05
From: Wisconsin


Leah,

Here's what I think you're saying: You have a table of document names, and you have a combobox based on this table. When the user enters a new document name that is not in the table, you want to automatically add it to the table, and have that document available as a choice from that point on. Is this correct?

If so, you may want to check out our Wiki article on how to handle this in the NotInList event of the combobox.

If I'm not correct, please provide details that I've missed/gotten wrong.

Hope this helps,

Dennis

--------------------
(;,;) Li'l Cthulu says: Please talk about what you're trying to do, as well as how you're doing it.
Changing your real table name to "Table1" and your real form name to "Form1" in your posts makes it more difficult to understand what's going on, not easier.
Guidelines for Posting Questions
Go to the top of the page
 
BruceM
post May 19 2017, 12:52 PM
Post#4


UtterAccess VIP
Posts: 6,991
Joined: 24-May 10
From: Downeast Maine


I assume cmbdocument is the combo box in question, but then what is Document_Name?

What is the Row Source for the combo box?
QUOTE
If I change the name or add a new document row

Please explain. Change the name where, and add it to what?

You mention tabs. Are you referring to pages on a tab control?

Go to the top of the page
 
tina t
post May 19 2017, 05:28 PM
Post#5



Posts: 5,182
Joined: 11-November 10
From: SoCal, USA


QUOTE
My combo box lists document names and returns the unique row that corresponds. If I change the name or add a new document row I want the list to update.

okay, i'll join the group of guess-ers here. my guess is that you have a form, bound to a table which stores a list of document names (and whatever other data goes with a document name). you have an unbound combobox control, which you probably created with the combobox wizard, and it's probably in the form's Header section, and you use it to navigate to a specific record in the form. right so far?

now if you add a new record in the form, you want the new record's document name available in the combobox droplist immediately. the crucial bit here is that you have to save the new record so that it is stored in the table, and therefore available to be included in the combobox droplist.

try the following, as

Private Sub Document_Name_AfterUpdate()

DoCmd.RunCommand accmdSaveRecord
Me.cmbdocument.Requery

End Sub

i'm not sure that you can save a record in a control's AfterUpdate event, as i've never tried it. but if my assumptions above are correct, but the Save solution doesn't work, we can try running the code somewhere else. it will help if you can clarify your form setup a bit, including answering the questions put by the other folks who posted - such as what you mean by "tab". i'm guessing that you're talking about the tab order of the controls on the form, but it's a lot easier for us to help you if we don't have to guess.

hth
tina

--------------------
"you can't take the sky from me"
Go to the top of the page
 
Leah
post May 22 2017, 10:44 AM
Post#6



Posts: 670
Joined: 22-February 00
From: New York, New York


Thank you, Mike, Bruce, Doctor9 and Tina for taking the time to reply.

I was talking about tab position on a particular record, however a variation of Tina's solution reminded me of something so that is the one I used. Therefore so I do not have to worry about getting to a particular tab for now. As for adding to a list, I did indeed benefit from that advise for a different Access "app" I put together a while back, thanks.

Rather than using Tina's

DoCmd.RunCommand accmdSaveRecord
Me.cmbdocument.Requery

I used a slight variation:

Me.Dirty = False
Me.cmbdocument.Requery


That worked.

As I recall I have sometimes had issues with the SaveRecord and again UtterAccess confirmed for me that Me.Dirty =False is a legitimate approach so I went there in the first place.

Thanks again everyone.

Leah

P S. I am pretty sure I will need some more help as this is something a bit different from the usual thing I have worked on. Just bothered me so much that something I thought was simple was giving me a hard time.




--------------------
Leah A. Kopel
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    21st November 2017 - 07:08 AM