I have a form “Chosen” which uses as its record source a query named “Chosen”. I set up this form as a tabular form so I can see more than one record at a time.
Here is my question:
As a test in the detail section of the form “Chosen” I created the subroutine
Private Sub Detail_Click()
Msgbox “Hello”
End Sub
And sure enough, every time I tab from one record to the next I get the message “Hello”
Then I changed the subroutine to this
Private Sub Detail_Click()
Sub2
End Sub
Where sub2 is a public subroutine on another module (Module 1)
Sub2
Msgbox Chosen!Q_Num
End Sub
Now the value of Chosen!Q_Num should change depending upon what is the current record in query “Chosen” but the message I get is always the same – it always displays the value of Q_Num for the first record in the query rather than the record I am clicking on in the form. Is there any way to cause the current record in the Query to correspond to the record where my cursor is on the form?
I have the following initialization code in Module1
Option Compare Database
Option Explicit
Public DB As DAO.Database
Public Questions As DAO.Recordset
Public Chosen As DAO.Recordset
Sub Init()
Set DB = CurrentDb
Set Questions = DB.OpenRecordset("Questions", dbOpenDynaset)
Set Chosen = DB.OpenRecordset("Chosen", dbOpenDynaset)
End Sub
There is a query “Chosen” set up with SQL
=” SELECT Questions.Chosen, Questions.Q_Num, Questions.Q_PrelimInfo, Questions.Q_Info
FROM Questions
WHERE (((Questions.Chosen)=True));”