Macro works for one, but not another

  • Thread starter Thread starter DeniseMSU
  • Start date Start date
D

DeniseMSU

Guest
I have a main data entry form called frmLoan1 that has command buttons that launch other forms. The forms have a field called strLoanNumber in common. When I launch each form, I want the strLoanNumber field to have the entry that is on the frmLoan1. I created a macro that is working for one of the command buttons using OpenForm and AddValue, with the Item [Forms]![frmLoan1]![strLoanNumber] and the expression being [strLoanNumber].

I have 2 additional command buttons that should use this same AddValue item and expression, but it's not working. Any Ideas?

I'm new to this and can't write code, so please be very basic in your answer. I greatly appreciate any help! Thanks!
 
I can interpret your post in three ways:

1) Your 'sub'Forms are not bound to any dataset (not looking up any other data)

In this case set the ControlSource for the 'strloan field' in the subform to:

=[Forms]![frmLoan1]![strLoanNumber]

2) you need the field to be updateable?

in which case you could set the Default:

=[Forms]![frmLoan1]![strLoanNumber]

3) You are looking up other data by the strloanNumber field. (You need to filter your subForm by the strLoanNumber field) In which case, for your SubForm's Query (the query that you put in as a recordsource) you could place:

[Forms]![frmLoan1]![strLoanNumber] under the criteria for the strLoanNumber



If none of this is what you want to do...maybe post a sample database if you can.
 
It works! Thank You!

Only the strLoanNumber field is in common. All of the forms that are opened using the command buttons are for additional input relating to strLoanNumber, but are needed based on situation. The tables are linked by the strLoanNumber, which is always unique.

Thank you! This is extremely helpful!
 

Users who are viewing this thread

Back
Top Bottom