Select query using wrong data (1 Viewer)

John Sh

Member
Local time
Tomorrow, 01:34
Joined
Feb 8, 2021
Messages
408
I have the following query attached to a combobox on a continuous form.
As I move through the records on the form the query operates on the first record even though a message box indicates the table has progressed to the next record.
Why is it so?
Code:
SELECT Taxon.Genus, Taxon.Family
FROM Taxon
GROUP BY Taxon.Genus, Taxon.Family
HAVING (((Taxon.Family)=[forms]![NilGenus]![txtFamily]))
ORDER BY Taxon.Genus;

The code for the form is super simple.

Code:
Option Compare Database
Option Explicit

Private Sub btnClose_Click()
    DoCmd.Close acForm, Me.Name
    DoCmd.OpenForm "Main Menu"
End Sub

Private Sub Form_Current()
    Me.cboGenus.SetFocus
    MsgBox Me.txtFamily.Value
End Sub

Private Sub cboGenus_Change()
    DoCmd.GoToRecord , , acNext
End Sub
 

Attachments

  • Screenshot_8.jpg
    Screenshot_8.jpg
    186.7 KB · Views: 193
  • Screenshot_9.jpg
    Screenshot_9.jpg
    218.7 KB · Views: 198

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:34
Joined
May 7, 2009
Messages
19,169
you need to Requery your combo on the Current event.
and since this is Continuous form, your "Other" combos will go will
sometimes go "blank" because of the filter.
you need a dummy textbox Overlayed on top of the combo to
fix (hack) that.
 

John Sh

Member
Local time
Tomorrow, 01:34
Joined
Feb 8, 2021
Messages
408
you need to Requery your combo on the Current event.
and since this is Continuous form, your "Other" combos will go will
sometimes go "blank" because of the filter.
you need a dummy textbox Overlayed on top of the combo to
fix (hack) that.
Too easy. I thank you for your assistance.
 

Users who are viewing this thread

Top Bottom