Combo Box Help.. Please Read ...

saleemMSMS

Registered User.
Local time
Today, 21:16
Joined
Aug 12, 2009
Messages
92
i have 2 tables
Book (BookID, Title, Price, Author)
Magazine (magID, Title, Edition, Publisher)

also i have an Order Table
Order (OrderID, Book/MagType, Book/MagID, DateTime)

i created a form for the Order form using the wizard and then added a combo box to the Book/MagType Column. (replaced the text box witha combo box and bounded it with the Book/MagType Field) (named ComboType)

also i got another combo box for the Book/MagID field. (named ComboID) the content of this combo is supposed to change according to the selection of ComboType.

so i coded the following in the ComboType AfterUpdate Event

Code:
Private Sub ComboType_AfterUpdate()
Me. ComboID.SetFocus
Select Case ComboType  
    Case "Book"
        Me. ComboID.RowSource = "Select BookID from Book"
    Case "Magazine"
        Me. ComboID.RowSource = "Select magID from Magazine"
End Select
Me. ComboID.Dropdown
End Sub

please note that the row source property of ComboType is not defined properties page since it has to be changed in the runtime as the code says..

this code works without any problem.
but.. when I re-open the form, all the columns except the ComboID are filled with the respective saved data..

my question is how can i fill the ComboType Column too when i'm viewing existing data. ?
 
If you apply the same code to the OnCurrent event of the form it should populate the row source for you.
 
when i included it in the onCurrent() event.. data appeared in the first record's type only. i.e the first record had a type of "Book" so all the books' ids were displayed.. but when a magazine was in between, again it stopped displaying.. :(
 

Users who are viewing this thread

Back
Top Bottom