M
Michael Stanbarger
I am using 3 subforms, 2 visible, 1 hidden.
frmFilters is a filter selection form.
frmArchives displays all records (abridged) in a continuous form.
frmArchiveTicketDisplay is a single record detail viewer which is hidden.
The filters are working fine, allowing multiple filters.
I am trying to write code so that when you doubleclick the PrimaryKey in the
frmArchives, it populates the relative fields of the frmArchiveTicketDisplay
and makes it visible.
I have successfully made it visible/not visible in the code, but it will
always default to the first record in the table.
I have been able to record the value of the PrimaryKey into a Global
Variable intTicketID. How can I use this variable to populate the
frmArchiveTicketDisplay with all of the fields from that particular recordset?
I have tried using a query, but cannot get the filter to work, so it still
displays the first record, or is blank (due to filter type mismatch).
I also tried putting a filter on the form, but I don't think that will work,
because a filter of that type is set on form load, and since the form is
already open, and just hidden, I need to make the fields change to the new
record.
Here is what I have so far:
Private Sub oTicketNumber_DblClick(Cancel As Integer)
' This properly sets intTicketID with the PrimaryKey value of the
recordset I want to display (intTicketID is Defined in a module as a global
integer variable)
intTicketID = Me.oTicketNumber
' This displays the current value of intTicketID.
MsgBox "intTicketID in the form is " & intTicketID
' The following line calls a module function to test the value of the
GlobalVar intTicketID
DisplayGlobal
' This one passes the value of intTicketID to a module and tests it there
as well
fTicketSelect (intTicketID)
Forms![frmDefaultMain]![frmManagement].Form![frmArchiveTicketDisplay].Visible
= True
Forms![frmDefaultMain]![frmManagement].Form![frmArchiveTicketDisplay].SetFocus
Exit_oTicketNumber_DblClick:
Exit Sub
Err_oTicketNumber_DblClick:
MsgBox Err.Description
Resume Exit_oTicketNumber_DblClick
End Sub
The following is the contents of the module I have to control this variable
(testing right now)
Option Compare Database
Public intTicketID As Integer
Public Function fTicketSelect(intTicketID) As Integer
dim intTest As Integer
intTest = "" & intTicketID & ""
MsgBox "intTicketID in the passing module is " & intTest
End Function
Public Function DisplayGlobal() As Integer
MsgBox "intTicketID in the global is " & intTicketID
End Function
I am open to suggestions to get the hidden form to show only this recordset
in the frmArchiveTicketDisplay form when it becomes visible.
frmFilters is a filter selection form.
frmArchives displays all records (abridged) in a continuous form.
frmArchiveTicketDisplay is a single record detail viewer which is hidden.
The filters are working fine, allowing multiple filters.
I am trying to write code so that when you doubleclick the PrimaryKey in the
frmArchives, it populates the relative fields of the frmArchiveTicketDisplay
and makes it visible.
I have successfully made it visible/not visible in the code, but it will
always default to the first record in the table.
I have been able to record the value of the PrimaryKey into a Global
Variable intTicketID. How can I use this variable to populate the
frmArchiveTicketDisplay with all of the fields from that particular recordset?
I have tried using a query, but cannot get the filter to work, so it still
displays the first record, or is blank (due to filter type mismatch).
I also tried putting a filter on the form, but I don't think that will work,
because a filter of that type is set on form load, and since the form is
already open, and just hidden, I need to make the fields change to the new
record.
Here is what I have so far:
Private Sub oTicketNumber_DblClick(Cancel As Integer)
' This properly sets intTicketID with the PrimaryKey value of the
recordset I want to display (intTicketID is Defined in a module as a global
integer variable)
intTicketID = Me.oTicketNumber
' This displays the current value of intTicketID.
MsgBox "intTicketID in the form is " & intTicketID
' The following line calls a module function to test the value of the
GlobalVar intTicketID
DisplayGlobal
' This one passes the value of intTicketID to a module and tests it there
as well
fTicketSelect (intTicketID)
Forms![frmDefaultMain]![frmManagement].Form![frmArchiveTicketDisplay].Visible
= True
Forms![frmDefaultMain]![frmManagement].Form![frmArchiveTicketDisplay].SetFocus
Exit_oTicketNumber_DblClick:
Exit Sub
Err_oTicketNumber_DblClick:
MsgBox Err.Description
Resume Exit_oTicketNumber_DblClick
End Sub
The following is the contents of the module I have to control this variable
(testing right now)
Option Compare Database
Public intTicketID As Integer
Public Function fTicketSelect(intTicketID) As Integer
dim intTest As Integer
intTest = "" & intTicketID & ""
MsgBox "intTicketID in the passing module is " & intTest
End Function
Public Function DisplayGlobal() As Integer
MsgBox "intTicketID in the global is " & intTicketID
End Function
I am open to suggestions to get the hidden form to show only this recordset
in the frmArchiveTicketDisplay form when it becomes visible.