Need Help Now.

skea

Registered User.
Local time
Today, 09:34
Joined
Dec 21, 2004
Messages
341
Hey Folks am in a Fix and i need help NOW.
I have two tables, table1 (DistID,CompanyID,District)
table2(DistID,District)
table one is a rowsource to a list box which is grouped in terms of District.
In the After Update Event Of The Listbox, i run the query to populate a combo box(MyCB) with one value.
Me.MyCB.RowSource = "SELECT DistID FROM table2 WHERE(District= '" & Me.MyListBox.Column(2) & "')"

Problem: I want to use this value(DistID) in MyCB on another form without manually going to the Combo Box (which i dont want to be visible) and selecting. How can i reference it.Is there an auto selection in VBA
Since a textbox cannot be given a rowsource, the MyCB was the best option.
 
Last edited:
How does OpenArgs work for a ComboBox! am talking about referencing a value from a combobox without clicking or updating it
for example:
If I have another Text Box On the Same Form. Iwant as my Combobox is populated from my query then after its population i get its value in the Textbox.
ie.
Private Sub MyListBox_AfterUpdate()
me.mytxtBox= Me.MyCB.Value
End Sub
 
skea said:
Problem: I want to use this value(DistID) in MyCB on another form without manually going to the Combo Box (which i dont want to be visible) and selecting. How can i reference it.Is there an auto selection in VBA
Since a textbox cannot be given a rowsource, the MyCB was the best option.

A quick and dirty response since I haven't used access in months...
If your value isn't in the query your building your form off of, then your new form should be a modal form (just one way to do it) on top of your other form with the combobox you are referencing.
In other words, if the value isn't being saved, then the form and combobox have to "live" or open to where you can go to that open form and reference that value, and then go back and apply that value to your current form in the sequence you want or need.
Either that or make it a stored value in which you can recall and use it on your current form or in the query you are using.

Cascading combo boxes work great on one form, when you start jumping around on forms and taking those values from one and apply to another, then things get a little dicey.

Hope that helps.
 
Last edited:
No it Doesnt Help.
Now to make my exolanation simpler,forget about my other form that i talked about earlier.

Lets say i have another textbox on the same form with my populated Combobox.
My Combobox is populated with a Value lets sat 5.

How To i get my Text Box to show this Value(5), without......
Manually going to the dropdown of the Combobox and Picking this Value 5 then, later assigning my textbox value to its value in the after update event of the Combo.?

i.e
Private Sub MyCB_AfterUpdate()
me.mytxtBox= Me.MyCB.Value
End Sub
 
Private Sub MyCB_AfterUpdate()
me.mytxtBox= Me.MyCB.Column(0)
End Sub


Where Column(0) is the first column, notice the first column starts at zero and any subsequent columns would be numbered like :

Column(1)
Column(2)
Column(3)
etc
 
Uncle Gizmo, you are right there, i just forgot that, but you can do this after manually updating or selecting record(5)
skea said:
How To i get my Text Box to show this Value(5), without......
Manually going to the dropdown of the Combobox and Picking this Value 5 then, later assigning my textbox value to its value in the after update event of the Combo.?
 
There's an example of this in the Sample Databases forum.

Hey Folks am in a Fix and i need help NOW

NOW? What entitles you to priority treatment? :confused:
 
SJ, when you are in a Do or Die Situation(deadline issues), one doesnt mind whether other people take his the issue a priority or not. In the long run the good samaritan hits what he targets.(Just To Solve The Problem)

Any way thanks for the information but whats the name of the thread to link to the sample database?
 
skea said:
when you are in a Do or Die Situation(deadline issues)

If you have deadlines they certainly don't mean anything to anyone else so there's no real point in mentioning anything as urgent or help required NOW.

Any way thanks for the information but whats the name of the thread to link to the sample database?

Something like Combobox examples.
 
Many Many Many Thanks SJ.
I will paraphrase it better next time.
 
skea said:
but you can do this after manually updating or selecting record(5)

you will have to find the event that occurs when you manually update all select your records. Then add this " me.mytxtBox= Me.MyCB.collum(0)"
within that the event.

Also there are form level events, one occurs every time you change something on your form maybe you could use that or one of the others.

If you are not sure about the order of the events, (and they are not always obvious so it is worth checking) you can stick a message box inside them as a way of debugging.

MsgBox "Event on Load Fired"
 
Yap Uncle,
thats a good tip. Let me go ahead and try it.

SJ. thanks,
I dowloaded Combobox examples but incidentally, i have got nothing out of it.
Which code routine there can help me.
I really couldnt synchronise it with my problem, Every thing there is so clear.
 
I also one time got this problem cracking my nut but didnt know how to solve it.If some one has any ideas,help out skea,me and other beneficiaries of this forum.
 

Users who are viewing this thread

Back
Top Bottom