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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo boxes and events 1

Status
Not open for further replies.

embryo

Programmer
Nov 27, 2004
46
US
Hello all-

I have a form with several subforms in it. One of them has a combo box which a doctor uses to select a medical diagnosis code. There is another combo box which is sometimes used to select a relevant diagnosis modifier.

I have it coded so that when the AfterUpdate event occurs on the diagnosis combo box, the modifiers combo box populates based on a simple query, using the diagnosis selection as it's where clause criteria.

This works perfectly, but only when initially adding a record. When subsequently opening the form to view or edit records, the modifier combo box, of course, is devoid of options unless you first click on and re-select an option from the diagnosis combo box. In fact, the actual stored modifier value doesn't even appear until you re-select an option from the diagnosis combo box???

I'm hoping somebody can tell me how to cause the modifier combo box to populate with the correct stored value and recordset data when the form loads and when there is a value in the diagnosis field.

I played around with the Open and BeforeUpdate events, but had no success. I also tried to find a way to utilize the Load event for the form..and the subform which these controls reside, but had no luck with that either.

Any help you can give me would be much appreciated!

Thanks,
Steve

Steve
---------------------------------------
IF WebApplicationProgrammer = True Then
ElectronicSheepHerder = True
End If
 
Have you tried a requery of the combo in the Current event of the form?
 
What is the actual code of the AfterUpdate event of the diagnosis combo box ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi-

The AfterUpdate does thr trick, but as I said, I need it to occur when the form first loads IF there is a value in the modifier field..

Private Sub PrimaryDXL_AfterUpdate()
ModPrimaryDXL.Requery
ModPrimaryDXL.SetFocus
End Sub

Steve
---------------------------------------
IF WebApplicationProgrammer = True Then
ElectronicSheepHerder = True
End If
 
I just wanted to know if you dynamically recreated the ModPrimaryDXL.RowSource property.
You may try to follow Remou's suggestion.
 
Remou, when I tried using the Load event in the master form, I could not get my code to recognize the controls on the subform, no matter how I referenced them, so I finally assumed that the Load event(and Current) were intrinsic to the form itself, and not controls within it.
But...I was trying to work with the master form and not the subform's Current event.

Per your suggestion, I tried the current event again, but this time I did so on the subform and it works a charm-

Thanks!
Steve

Steve
---------------------------------------
IF WebApplicationProgrammer = True Then
ElectronicSheepHerder = True
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top