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!

Access search combo box with VBA

Status
Not open for further replies.

Aurillius

Programmer
Jun 3, 2004
60
CA
Hi,
I have a form that is generated from a search from the original form. The new form displays a query from which I want to double click one line and have it select the exact item from the related combo box and text box on the original form.

This is the code that I started and it's executed from the search form. While it enters the correct value in the combo box...it doesn't actively choose it. If this code is generated correctly, choosing the correct item from the combo list will trigger an event which will populate other list boxes on the form.

Here's what I started with on the search form:


Private Sub MakeName_DblClick(Cancel As Integer)

Forms!Form1.Combo2.SetFocus
Forms!Form1.Combo2.Value = RTrim(MakeName.Value) 'this would be "Ford"
Forms!Form1.List4.SetFocus
Forms!Form1.List4.Value = RTrim(modelname.Value) 'this would be "Ranger"


End Sub
 
Hi
Could it be:
MS Help AfterUpdate said:
Changing data in a control by using Visual Basic or a macro containing the SetValue action doesn't trigger these events for the control. However, if you then move to another record or save the record, the form's BeforeUpdate and AfterUpdate events do occur.
 
You can:
- call the relevant procedure from your second form
(Call Form_Form1.Combo2_AfterUpdate),
- or add the necessary code to your second form
- or Create a Function that can be used by both forms.

I have often regretted not putting proper names (eg frmCars) on forms and controls at an early stage.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top