Acc97: Problem with ComboBox after lost focus

  • Thread starter Thread starter noodnutt
  • Start date Start date
N

noodnutt

G'day ppl,

This is what I have in the RowSource of AnimalBookCombo:

SELECT tblAnimalDetails.AnimalID, tblAnimalDetails.AnimalName FROM
tblAnimalDetails WHERE
(((tblAnimalDetails.OwnerID)=[forms]![frmbookings]![clientbookcombo]));

For all intensive purposes, it works well when first used, but, if my client
moves back to any previous booking, the AnimalBookCombo still shows the
filter for the new booking, what she has to do is to re-select the client
from the Clientcombo to re-apply the filter on the Animalcombo..

Any thoughts

TIA

Mark.
 
Mark,

That's because when you change records, the value selected in the
ClientCombo is cleared. If you want to retain this value as you move from
record-to-record, you can use a module-level variable.

Option Compare Database
Option Explicit

Private vOwnerID As Variant

Private Sub ClientBookCombo_Change()
vClientID = Me!ClientBookCombo
End Sub

Private Sub Form_Current()
If Not IsNull(vClientID) Then
Me!ClientBookCombo = vClientID
Me!AnimalBookCombo.Requery
End If
End Sub


Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
G'day Graham,

Thx heap for that, it works a treat, by the way, how is sunny Sydney town,
Melbourne starting the decline into the dreaded winter months, altho, still
some nice rays at the mo.

reg's

Mark.
Graham R Seach said:
Mark,

That's because when you change records, the value selected in the
ClientCombo is cleared. If you want to retain this value as you move from
record-to-record, you can use a module-level variable.

Option Compare Database
Option Explicit

Private vOwnerID As Variant

Private Sub ClientBookCombo_Change()
vClientID = Me!ClientBookCombo
End Sub

Private Sub Form_Current()
If Not IsNull(vClientID) Then
Me!ClientBookCombo = vClientID
Me!AnimalBookCombo.Requery
End If
End Sub


Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

noodnutt said:
G'day ppl,

This is what I have in the RowSource of AnimalBookCombo:

SELECT tblAnimalDetails.AnimalID, tblAnimalDetails.AnimalName FROM
tblAnimalDetails WHERE
(((tblAnimalDetails.OwnerID)=[forms]![frmbookings]![clientbookcombo]));

For all intensive purposes, it works well when first used, but, if my
client
moves back to any previous booking, the AnimalBookCombo still shows the
filter for the new booking, what she has to do is to re-select the client
from the Clientcombo to re-apply the filter on the Animalcombo..

Any thoughts

TIA

Mark.
 
Weather seems good. I've only just returned to Sydney after a stint in
Canberra, which surprisingly was also OK.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

noodnutt said:
G'day Graham,

Thx heap for that, it works a treat, by the way, how is sunny Sydney town,
Melbourne starting the decline into the dreaded winter months, altho,
still
some nice rays at the mo.

reg's

Mark.
Graham R Seach said:
Mark,

That's because when you change records, the value selected in the
ClientCombo is cleared. If you want to retain this value as you move from
record-to-record, you can use a module-level variable.

Option Compare Database
Option Explicit

Private vOwnerID As Variant

Private Sub ClientBookCombo_Change()
vClientID = Me!ClientBookCombo
End Sub

Private Sub Form_Current()
If Not IsNull(vClientID) Then
Me!ClientBookCombo = vClientID
Me!AnimalBookCombo.Requery
End If
End Sub


Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

noodnutt said:
G'day ppl,

This is what I have in the RowSource of AnimalBookCombo:

SELECT tblAnimalDetails.AnimalID, tblAnimalDetails.AnimalName FROM
tblAnimalDetails WHERE
(((tblAnimalDetails.OwnerID)=[forms]![frmbookings]![clientbookcombo]));

For all intensive purposes, it works well when first used, but, if my
client
moves back to any previous booking, the AnimalBookCombo still shows the
filter for the new booking, what she has to do is to re-select the client
from the Clientcombo to re-apply the filter on the Animalcombo..

Any thoughts

TIA

Mark.
 
Back
Top