473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

2 if then else statements or 2 of the same forms and reports? you choose! lol

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!

Nov 13 '05 #1
2 2450
Looks like a mountain out of a molehill

A simple comboBox or List box Combo1 on your candidate form with the
RowSource something like
SELECT CandidateName, CandidateID FROM Candidates ORDER BY CandidateName;

2 Columns, Width 3,0 Bound Column 2
Private Combo1_AfterUpdate

DoCmd.GotoControl CanDidateID
DoCmd.FindRecord Combo1
End Sub

Select the candidate from the combo box and you get the correct record.

Have an option group with various option buttons to print different reports.

If you want to hide different fields, do this on the OnCurrent of the form

Private Sub Form_Current()
If CandidateType = 2 Or CandidateType = 4 ............
xxxx.Visible = False
else
xxxx.Visible = True
end if

End Sub
"misscrf" <mi*****@yahoo.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
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!

Nov 13 '05 #2

I think that you are on the right path, but there seems to be other
factors that I still need to take care of here. I have been told by the
future users that they need to be able to search for candidates, for
entry and reporting. A common reason is that a partner in the firm may
come to them and say "remember that candidate that went to Harvard?" if
that is all the info that they have, or they are only given 1 piece of
info, then they need a full search form.

My search form is unbound, and the subform with results is bound to a
query which has all fields a person might want to search on.

I like the idea of a combo box, but also, the reason for a candidate
report button on the entry form is not for printing. They usually
wouldn't want to waste paper or take the time to pick up a print. a
report is an easy way to see all of a candidate's info in one place, and
quickly close it. They can also then choose to print or pdf and email
to anyone ie the partner requesting the info.

Also, even with this method, I still need to take care of the criteria
on the backend of the report. I am not used to using code for a report,
so I even though I can imagine what it would be, I am not sure where i
would put it.

I have the report ( which has a bunch of subreports; that shouldn't
matter) and it is bound by the query builder.

I would think that I would do something like

if frmfindcandidate.isopen then
candid = candid
else
candid = forms!frmcandidateentry!candid
end if

something like that.

Anyway. I really want to figure this out from the perspective of this:

How does one use 1 form and 1 report in multiple places, controlling
where it grabs and places stuff based on how it was activated etc.

Thanks for the ideas. I will look at the app again on Monday to see
what I may be able to reconsider from your advice. It does make some
sense. I think I wasn't expecting to hear that my plan was overkill,
because I see programmers use these methods so often.

misscrf

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SJM | last post by:
I have a reporting database that has a series of pre-defined Pivot Table screens. What I would like to do is to enable users to be able to save their own configurations. I found 2 ways of doing...
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
4
by: Brie_Manakul | last post by:
I need to set up an if else to show different weather scripts based on the city selection they choose. Any help on this would be great. Thanks! <%@ page language="java" import="java.util.*,...
22
by: MLH | last post by:
I would like to test some of this code in the debug window... Option Compare Database Option Explicit Private Sub Command0_Click() #If Win32 Then MsgBox "Hey! It's WIN32." #End If End Sub
0
by: mafandon | last post by:
I am running a report based on parameters from a form. The parameters are between two dates (ie: 1/1/2006 to 1/31/2006). However, I can choose different dates, obviously. My report gets all...
4
by: Raj | last post by:
Can we create an event monitor for statements in a partitioned environment? CREATE EVENT MONITOR stmt_event FOR STATEMENTS WRITE TO FILE '/home/rajm/event' ON PARTITION 0 GLOBAL DB21034E ...
14
by: lawjake | last post by:
I am having a dispute at work over endifs, and cannot find any treatise on this. So I am hoping that I can get a lot of correspondece confirming my belief. Here it is: I believe the following:...
4
by: sshafer1 | last post by:
I am an avid user of Crystal Reports. I'm in a new job that is requiring me to build an access database. I know that I can write a formula in Crystal to accomplish what I am looking for, however, I...
4
by: Tangleman | last post by:
I have a schema that defines a programming language for a script that drives a sequentially executing process. It defines the structure of a script that has to interact with a pre-existing,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.