Switch Control Sources via a button?

november

Registered User.
Local time
Today, 08:35
Joined
Oct 6, 2008
Messages
30
I have a form displaying cost increase data by supplier for our PM's.

We send out templates to be filled out.

I want to have 4 buttons total, maybe 5.


  • Merchandise where templates have been sent
  • Merchandise including suppliers where no template was sent
  • Parts where templates have been sent
  • Parts including suppliers where no template was sent
I currently have a continuous form setup. With these buttons can I have VBA change the control source for the query data?

Should I use a sub forms?(would prefer not to).

If I use a subform will I be able to use the "continuous form" layout?
 
With these buttons can I have VBA change the control source for the query data?

Yes

This will change record source, I copied one of mine

Forms!PrintAndClose.RecordSource = "GridJoinNamesSingle"

You can change just about most of the things on form. When the change is made it is lost when the form is close as it then returns to the default value that you used when you made the form

Should I use a sub forms?(would prefer not to).

You can't add a subform to a continuous form.

If I use a subform will I be able to use the "continuous form" layout?

A subform is normally done as a continuous form added to a single form.

Instead of subform you can open a continuous form from your mainform and for related records. If you don't need to see related records all of the time that can be a better option than using a subform as you don't burn a screen space on your main form.

You can also make a related record form open automatically based on conditions that exist on the main form record. You can do this by using the OnCurrent event.
 
Well I may be using the same query and just change criteria in it via variables.

I tried using * as a wildcard but it doesn't work.

Currently in my query I have it referencing a combo box value.

So if I open the form manually I have to type in the data.

How can I use a wild card like this? Do I need some sort of if statement?

If cbo has value then use cbo.value else use *nothing*

Thanks
-Nic
 
Sorry, I missed oyur post back:)

Using in a query criteria

[Forms]![MasterForm]![Text1577]

Won't work when Text1577 has something like 123*

But

Like [Forms]![MasterForm]![Text1577]

will work.

Opening related forms is similar.

DoCmd.OpenForm "RateAddress", acNormal, "", "[NameNumber] Like [Forms]![MasterForm]![Text1577]", acEdit, acNormal

DoCmd.OpenForm "RateAddress", acNormal, "", "[NameNumber] Like [Forms]![MasterForm]![Text1577]", acEdit, acNormal
 

Users who are viewing this thread

Back
Top Bottom