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

Running Command Button from code

Status
Not open for further replies.

TranPlan

Technical User
Mar 7, 2001
5
US
I have a simple form/subform/subform setup, with a Combo Box on the main form and a "Refresh" button on the 1st subform. A query makes up the 2nd subform.

When updating the combo box, the data in the query, or 2nd subform updates, but the other information related specifically to the 1st subform, does not. The refresh button on the 1st subform does the trick, but I want the Combo Box update to refresh everything -

Any Ideas?

Thanks!

Jon
 
If the form is bound to a datasource then .Requery is waht you should be using.

If you click on the combo box in Design view
and in its "All" properties find "AfterUpdate" event
its down away click it then clik cth elittle black arrow and choose "Event Procedure" (top option) then click the 3 dots button.
Next put this code in between the Sub Comboxxxx
and the End Sub

it should look like this

Private Sub Combo0_AfterUpdate()
Call Command2_Click ' <<< this is the name of your Command button
End Sub

'Note Combo0 is the name of mine, yours is different

If you are using somthing else then maybe use
Me.Requery 'to refresh a datasource
like this
Private Sub Combo0_AfterUpdate()
Me.Requery
End Sub




DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top