Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with a macro/form combo

Status
Not open for further replies.

platypus71

Technical User
Sep 7, 2005
68
US
I know I should probably scrap this macro and write the VB code, but I was hoping not to have to do that.

Here is the problem:
I have a form called OriginalForm with a button and a field called "EventID" (and other stuff that is not relevant here). When you click the button, it executes a macro that opens a new form called NewForm, makes changes to that form, prints the form and closes the form.

The "Where Condition" in the macro for opening the form is [EventID]=[Forms]![OriginalForm]![EventID]

It works great the first time. However, if I change EventIDs to a different one and click the button, the NewForm that opens is for the same EventID as before.

What do I need to do/change to make the EventID being read in be the new one?
 
You should just add it to the button..its really easy. Ive had that problem myself many time. If you open the form in design view and open the VB editor you shopuld see something like this for the button

stDocName = "NewForm"

DoCmd.OpenForm stDocName, , , stLinkCriteria

so in between those two lines just add your where condition and take it out of the query...something like this:

stLinkCriteria = "[EventID]= Me![EventID]"

you might have to play w/ the quotes a bit. Then your done and it will work every time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top