Multifunction Form

R

Rod

I have a form, frmCalling, which differes from the form frmFind Candidate
only by
1) frmFind Candidate asks you for a name to serch for in tblCandidates using
qFind Candidates, and
2) frmCalling uses uses qCalling.

Given that the two forms are otherwise the same, is there a way for me to
tell frmCalling to not use qFind Candidates instead of qCalling without
having to rebuild the entire form? I would like to be able to do something
like, if no filtering values are inputted for the search criteria, then bring
back everything (I think I can handle this part), but the trick is changing
frmCalling from using qCalling to using qFind Candidate.
 
S

Sprinks

Hi, Rod.

You can use a single form for both recordsets. Just set the RecordSource
property manually after opening the form:

Dim stDocName as String

stDocName = "YourForm"
DoCmd.OpenForm stDocName
Forms!YourForm.RecordSource = "YourQuery"

Sprinks
 
M

MartinL

I have the same situation but I need to open the form from a Command button
from the Switchboard, and based on which button is clicked I will open a
certain table using one single form. What I need to know is what code goes in
which event in the command button and what I need to modify in the form to
make it work.

Thanks in advance!

ML
 
S

Sprinks

Martin,

The only code required, in the OnClick event of the command button, is as
was described:

Dim stDocName as String

stDocName = "YourForm"
DoCmd.OpenForm stDocName
Forms!YourForm.RecordSource = "YourQuery"
 
M

MartinL

Hi Sprinks,

I have this working and I am also sending the week number when I call the
form by using the following which works just fine because the form window
that opens does say "Microsoft Access - Week 24":

Forms!FormWeeks.Caption = "Week 24"

My only question is that on the form side I would also like to be able to
use this week value for another date calculation I need to do. How can I get
this value once the form opens? I tried to using the form.caption but all I
get is a blank using the following:

MsgBox ("caption=" & Me.Form.Caption)

Is there any other way of doing this? . . .

Once again, thanks in advance.
ML
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top