OrionElectrotech
Technical User
I have a simple database of candidates, where their data is displayed on a form (Candidate Information).
I have used some scripting (taken from this site I think!) to enable to user to open another window if they need to view 2 candidates at once (a command button on the form) -
Option Compare Database
Public clnCandidate As New Collection 'Instances of CANDIDATE INFORMATION.
Function OpenACandidate()
'Purpose: Open an independent instance of form CANDIDATE INFORMATION.
Dim frm As Form
'Open a new instance, show it, and set a caption.
Set frm = New [Form_CANDIDATE INFORMATION]
frm.Visible = True
frm.Caption = frm.Hwnd & ", opened " & Now()
'Append it to our collection.
clnCandidate.Add Item:=frm, Key:=CStr(frm.Hwnd)
Set frm = Nothing
DoCmd.Close acForm, "Open a new candidate window?"
End Function
Function CloseAllCandidates()
'Purpose: Close all instances in the clnCandidate collection.
'Note: Leaves the copy opened directly from database window/nav pane.
Dim lngKt As Long
Dim lngI As Long
lngKt = clnCandidate.Count
For lngI = 1 To lngKt
clnCandidate.Remove 1
Next
End Function
I also have a "Go To" command button on a search form that will display the Candidate Information form for a selected candidate -
Private Sub go_to_Click()
On Error GoTo Err_go_to_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CANDIDATE INFORMATION"
stLinkCriteria = "[ca_Name]=" & "'" & Me![ca_name] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_go_to_Click:
Exit Sub
Err_go_to_Click:
MsgBox Err.Description
Resume Exit_go_to_Click
End Sub
Not having ANY vb knowledge, I have no idea if the 2 can be merged so that when viewing the selected candidate from the search it also opens in a new window??
Caroline
I have used some scripting (taken from this site I think!) to enable to user to open another window if they need to view 2 candidates at once (a command button on the form) -
Option Compare Database
Public clnCandidate As New Collection 'Instances of CANDIDATE INFORMATION.
Function OpenACandidate()
'Purpose: Open an independent instance of form CANDIDATE INFORMATION.
Dim frm As Form
'Open a new instance, show it, and set a caption.
Set frm = New [Form_CANDIDATE INFORMATION]
frm.Visible = True
frm.Caption = frm.Hwnd & ", opened " & Now()
'Append it to our collection.
clnCandidate.Add Item:=frm, Key:=CStr(frm.Hwnd)
Set frm = Nothing
DoCmd.Close acForm, "Open a new candidate window?"
End Function
Function CloseAllCandidates()
'Purpose: Close all instances in the clnCandidate collection.
'Note: Leaves the copy opened directly from database window/nav pane.
Dim lngKt As Long
Dim lngI As Long
lngKt = clnCandidate.Count
For lngI = 1 To lngKt
clnCandidate.Remove 1
Next
End Function
I also have a "Go To" command button on a search form that will display the Candidate Information form for a selected candidate -
Private Sub go_to_Click()
On Error GoTo Err_go_to_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "CANDIDATE INFORMATION"
stLinkCriteria = "[ca_Name]=" & "'" & Me![ca_name] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_go_to_Click:
Exit Sub
Err_go_to_Click:
MsgBox Err.Description
Resume Exit_go_to_Click
End Sub
Not having ANY vb knowledge, I have no idea if the 2 can be merged so that when viewing the selected candidate from the search it also opens in a new window??
Caroline