Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing cbo box list

Status
Not open for further replies.

doerfohio

Technical User
Aug 30, 2004
34
US
I have a form that I enter job positions into: Positions
My main form, Time Clock has a combo box with a list of positions, which is is list from a query called CboPositionsQuery ( I did the cbo box through a query,not the table, so I could have it show up alphabetized). When I input a new postions in the Positions form, I'd like to have the cbo box refreshed in the Time Clock form.

In summary, on the close event of the Positions form, I'd like to requery CboPostionsQuery and refresh cboPositions on the Time Clock form but I don't know to code that. Can anyone help me?

TIA
 
See thread702-1025565

Zameer Abdulla
[sub]Jack of Visual Basic Programming, Master in Dining & Sleeping[/sub]
Visit Me
 
Sorry, I'm not experienced with this at all. I'm getting a syntax error. Here's what I have on the close event of the Positions form:

Forms!Time Clock!Positions.Form.Requery

 
Sorry, I'm still lost. This stuff isn't in my language ; )
 
doerfohio said:
This stuff isn't in my language
What you mean by that?
There are two ways to refresh the combobox
either open the second form as modal then place requery after that statement. So the requery will take place after closing the second form. sample below. You have to change the form & Control names.
Code:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "SecondForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria,,acDialog
[b][COLOR=red]Me.MyComboBox.Requery[/color][/b]
or
Code:
Forms![Time Clock]!CboPositionsQuery.Requery
This can be OnClose Event of the second form
Hope this helps


Zameer Abdulla
[sub]Jack of Visual Basic Programming, Master in Dining & Sleeping[/sub]
Visit Me
 
I guess I meant that I speak english, not Access. Dim is something I do to my headlights at night, string is what I use to sew, exclamation points are used after grammatical interjections. Those are the only meanings I know : )
My experience with Access is mostly just data entry.

I tried the code
Forms![Time Clock]!CboPositionsQuery.Requery

I'm getting an error message saying that Access can't find the form Time Clock. I don't understand that (even though it really is very simple english!) because my form is called Time Clock. Just like that, one space, two capitals, correct spelling. But I'm entering the info from the Positions form. Is that where the mistake is?

I'm entering a new position into the positions form. I want to refresh that in the Time Clock table's Staff Name cbo box of the Time Clock.

I'm sorry, I'm probably being about as clear as mud...
 

>>I'm entering a new position into the positions form. I want to refresh that in the Time Clock table's Staff Name cbo box of the Time Clock.<<

Oops! I didn't mean Staff Name cbo, I meant cboPositions.
 
Ok I finally got it! Your code was perfect! I had just closed the Time Clock form. Duh!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top