![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a search form that is great. I have modified it in such a way, that when search results come up I can bring it back to a useful spot, say an entry form or a report. Here is my lemon ( hoping someone can help me make lemonade!) I have this form implemented with my Candidate entry form, as a find. click the find button, search, subsearch form shows results, click select on the needed record, and the search form closes, the entry form now at that record. I previously had this as the report form, choose a candidate report from the reports menu, and get this search form, find your candidate, hit select, and report with that candidate comes up. Now the challenge. My first clumsy thought is to make 2 search forms and subforms, and 2 candidate reports ( since I have a quick candidate report button on the entry form, for easy access - this is important because the report gets its candid parameter from the entry form in this instance, from report menu it would get it from the search form result chosen.) Then I thought that a lot of programmers would yell at me for something like this, because I would be duplicating forms and reports because of dual points of entry on the one form and report. I am trying, then, to use the one search form to act as both the entry search form and the report search form. I also want the candidate report to work from the entry form interface and the report menu interface. Now the code I am working with is on the button in the subform of the search form. I need to add some code to what already works. Basically right now it says to bring back the current record to the candidate entry form, and if the candidate type is one of a few then to show that page that only shows under that condition. Because of that, I don't know how to put an encompassing if else statement outside of that. I need to add that if the candidate entry form is open ( in background when being used for finding entry) then to bring record back to entry form (and with that if candidate is one of a few types show that page too), else to bring that candidate to the candidate report, and preview it.... here is the code for the bring back to entry form: code: Private Sub CmdGetCand_Click() On Error GoTo Err_CmdGetCand_Click Dim Rs As DAO.Recordset Set Rs = Forms!frmCandidateEntry.RecordsetClone Rs.FindFirst "[CandID] = " & Me!CandID Forms!frmCandidateEntry.Bookmark = Rs.Bookmark Set Rs = Nothing If Forms!frmCandidateEntry!cmbCandidateType = 2 Or Forms!frmCandidateEntry!cmbCandidateType = 4 Or Forms!frmCandidateEntry!cmbCandidateType = 5 Or Forms!frmCandidateEntry!cmbCandidateType = 9 Or Forms!frmCandidateEntry!cmbCandidateType = 10 Or Forms!frmCandidateEntry!cmbCandidateType = 12 Then Forms!frmCandidateEntry!TbCandSubs.Pages.Item(0).V isible = True Else: Forms!frmCandidateEntry!PgAttInfo.Visible = False End If DoCmd.Close acForm, "frmFindCandidate" Exit_CmdGetCand_Click: Exit Sub Err_CmdGetCand_Click: MsgBox Err.Description Resume Exit_CmdGetCand_Click End Sub ---- I would think to add something in the beginning like if forms!frmCandidateEntry.isopen then... and then at the end put else docmd.previewreport rptCandidatereport Just thinking that with the if then else statement in the middle that the code would get confused when to endif on what endif. catch my drift? ------------------------------------- I will worry about fixing the reports conditional criteria after this is fixed. -- that would be whether it should get the candid from the entry form or the search form. Thanks for any who can help! |
#3
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |