Form to open form with command button using WHERE statement in Mac

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have one form that uses a command button going to a macro that opens
another form. The new form is supposed to have many of the same values as
the first form with a subform detaining errors. I can not get the second
form to open up at the same record as the first.

Both forms are based of the same table. Subform is linked via id of 1st
table.
I have tried several expressions but none seem to work. What calculation
would work best?
 
in your OpenForm action, go to the Action Arguments and set a Where
Condition, as

[PrimaryKeyFieldName] = Forms![FirstFormName]![PrimaryKeyFieldName]

*note: adding, editing or deleting the same record from two separate open
forms can cause problems. you might want to consider an alternate solution,
especially if other people will use these forms.*

hth
 
Thanks, I had the whole field name and that was not working. Just the Name
without the [Forms]![etc...] worked. Now I have to figure out how to get it
to link while I am creating a new record and hit this button. Thanks.

tina said:
in your OpenForm action, go to the Action Arguments and set a Where
Condition, as

[PrimaryKeyFieldName] = Forms![FirstFormName]![PrimaryKeyFieldName]

*note: adding, editing or deleting the same record from two separate open
forms can cause problems. you might want to consider an alternate solution,
especially if other people will use these forms.*

hth


James Kendall said:
I have one form that uses a command button going to a macro that opens
another form. The new form is supposed to have many of the same values as
the first form with a subform detaining errors. I can not get the second
form to open up at the same record as the first.

Both forms are based of the same table. Subform is linked via id of 1st
table.
I have tried several expressions but none seem to work. What calculation
would work best?
 
yes, that's one of the problems i mentioned previously.


James Kendall said:
Thanks, I had the whole field name and that was not working. Just the Name
without the [Forms]![etc...] worked. Now I have to figure out how to get it
to link while I am creating a new record and hit this button. Thanks.

tina said:
in your OpenForm action, go to the Action Arguments and set a Where
Condition, as

[PrimaryKeyFieldName] = Forms![FirstFormName]![PrimaryKeyFieldName]

*note: adding, editing or deleting the same record from two separate open
forms can cause problems. you might want to consider an alternate solution,
especially if other people will use these forms.*

hth


I have one form that uses a command button going to a macro that opens
another form. The new form is supposed to have many of the same values as
the first form with a subform detaining errors. I can not get the second
form to open up at the same record as the first.

Both forms are based of the same table. Subform is linked via id of 1st
table.
I have tried several expressions but none seem to work. What calculation
would work best?
 
Here is the second half of the story. I am entering information into the
form and hit a button opening the linked form. It will not show the new
information from the newly created record. I have the macro save the form
first then open based on above criteria. If I close out of the form and go
to the old entry then click the button it works just fine. Do I need to so
something other than save the form in order to get it to come up correctly?
 
i'm not sure what you mean by "I have the macro save the form
first". are you saving the *record* before opening the second form?

again, i'm not the best person to help you get around the problems inherent
in using two forms to display/modify the same record at the same time. i
have no experience in work-arounds, because i avoid those problems by not
doing it in the first place. if you're determined to stick with this setup,
maybe somebody else will be able to give you a hand. good luck. :)
 
James,

I agree with Tina when she suggests that there are probably better ways
to achieve your purpose. Nevertheless, based on your description so
far, I would expect it to work as you require, as long as you are saving
the record on the first form before opening the second.
 
Thanks for your time. What I ended up doing because it would not work for
some reason (probably because I'm missing something very simple). I changed
the button location to the bottom of the form and required it to close the
first form (saving the record) then opening the second. On close of the
second form it reopended the first. As a perfectionist it is not exactly
what I wanted but it will work and serve its purpose. Maybe I will work with
this later when I have a few extra minutes. Thanks again.
 
Back
Top