Why, please...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have a form with 2 comboboxes - cboTC and cboNAI - and list box - ListBox.
When AfterUpdate 1stCombo, ListBox requery and work fine.
When AfterUpdate 2ndCombo, don't requery ListBox.
The form is based in T_GeneralData.
The list box is based in Q_PesqMultiC

- The 1stCombo: cboTC

CboTC_AfterUpdate()
Me.txtTC1 = Me.cboTC
Me.txtTC2 = Me.cboTC
Me.txtTC1.Visible = True
Me.txtTC1.SetFocus
Me.cboTC.Visible = False
Me.cboTC = ""
Me.ListBox.Requery

GotFocus:
Me.cboTC.Dropdown
Me.ListaBox.Requery

In RowSource:
SELECT DISTINCT Q_PesqMultiC.TC FROM Q_PesqMultiC ORDER BY Q_PesqMultiC.TC;

(work fine)
___________________________

- The 2ndCombo: cboNAI

CboTC1_AfterUpdate()
Me.txtNAI1 = Me.CboNAI
Me.txtNAI2 = Me.CboNAI
Me.txtNAI1.Visible = True
Me.txtNAI1.SetFocus
Me.CboNAI.Visible = False
Me.CboNAI = ""
Me.ListaGeral.Requery

GotFocus:
Me.CboNAI.Dropdown
Me.ListaBox.Requery

In RowSource:
SELECT DISTINCT Q_PesqMultiC.NAI FROM Q_PesqMultiC WHERE
(((Q_PesqMultiC.NAI) Like [Forms]![F_PesqMultiCampo]![txtNAI2]) AND
((Q_PesqMultiC.TC) Like [Forms]![F_PesqMultiC]![txtTC2])) ORDER BY
Q_PesqMultiC.NAI;

(don't requery my list box)

Any ideia very will be well received.
Thanks in advance.
an
 
An,

The AfterUpdate event procedure you say is for cboNAI is named for a control
named cboTC1, so this code is not executing on the update of cboNAI.

Also, you sometimes refer to "Listbox", while other times to "Listabox" or
"ListaGeral". Perhaps this is what you intend.

Hope that helps.

Sprinks
 
Ok.
Thanks for help.
an

Sprinks said:
An,

The AfterUpdate event procedure you say is for cboNAI is named for a control
named cboTC1, so this code is not executing on the update of cboNAI.

Also, you sometimes refer to "Listbox", while other times to "Listabox" or
"ListaGeral". Perhaps this is what you intend.

Hope that helps.

Sprinks

an said:
Hi!

I have a form with 2 comboboxes - cboTC and cboNAI - and list box - ListBox.
When AfterUpdate 1stCombo, ListBox requery and work fine.
When AfterUpdate 2ndCombo, don't requery ListBox.
The form is based in T_GeneralData.
The list box is based in Q_PesqMultiC

- The 1stCombo: cboTC

CboTC_AfterUpdate()
Me.txtTC1 = Me.cboTC
Me.txtTC2 = Me.cboTC
Me.txtTC1.Visible = True
Me.txtTC1.SetFocus
Me.cboTC.Visible = False
Me.cboTC = ""
Me.ListBox.Requery

GotFocus:
Me.cboTC.Dropdown
Me.ListaBox.Requery

In RowSource:
SELECT DISTINCT Q_PesqMultiC.TC FROM Q_PesqMultiC ORDER BY Q_PesqMultiC.TC;

(work fine)
___________________________

- The 2ndCombo: cboNAI

CboTC1_AfterUpdate()
Me.txtNAI1 = Me.CboNAI
Me.txtNAI2 = Me.CboNAI
Me.txtNAI1.Visible = True
Me.txtNAI1.SetFocus
Me.CboNAI.Visible = False
Me.CboNAI = ""
Me.ListaGeral.Requery

GotFocus:
Me.CboNAI.Dropdown
Me.ListaBox.Requery

In RowSource:
SELECT DISTINCT Q_PesqMultiC.NAI FROM Q_PesqMultiC WHERE
(((Q_PesqMultiC.NAI) Like [Forms]![F_PesqMultiCampo]![txtNAI2]) AND
((Q_PesqMultiC.TC) Like [Forms]![F_PesqMultiC]![txtTC2])) ORDER BY
Q_PesqMultiC.NAI;

(don't requery my list box)

Any ideia very will be well received.
Thanks in advance.
an
 
Back
Top