none
Enter Parameter Value

    Question

  • In Microsoft Access 2010 I get and Enter Paramer Value message box when I open a form. The message box refers to a criteria in a query for a row source for a combo box in a subform. I used the prompted entery method so I am pretty sure the syntax is correct [Forms]![4m_Form]![4m_Body_Area_ID] where 4m_Form is the main form and 4m_Body_Area_ID is the control. Strangly if I re-insert the 4m_Body_Area_ID control the form loads correctly and works till the next time I save and close the database. I would appreciate any suggestions.
    Tuesday, August 21, 2012 12:34 PM

Answers

  • Can you rename your form to a legal name, something like:  rh4mForm ( rh for your initials, and I also removed the _ which is used internally by VBA, such as to define an event handling procedure, or classes (like   4m_form_form   ?!  ) ... Not a good idea to use them.

    • Marked as answer by Reb Hodgson Tuesday, August 21, 2012 4:21 PM
    Tuesday, August 21, 2012 4:12 PM
    Moderator

All replies

  • Hi Reb Hodgson,

    I think that you're asked to enter a value when you open the form because 4m_Body_Area_ID has no value. When you have a value in it the query can be executed without prompt for a value because the value is available.

    If you provide a value to your combo row source when 4m_Body_Area_ID has no value everything'll work properly.

    HTH Paolo

    Tuesday, August 21, 2012 1:10 PM
  • If the control to be reached is in a subform, the syntax is

      FORMS!mainFormNameHere!SubformControlNameHere!FORM!ControlNameInTheSubForm

    Note: You can try it in the Immediate Debug Window. Open the form, fill the right control with the right value, then, in th immediate debug window, type:

    ?  FORMS!mainFormNameHere!SubformControlNameHere!FORM!ControlNameInTheSubForm

    You should get the value. If not, there is something wrong with the syntax.

    Tuesday, August 21, 2012 2:12 PM
    Moderator
  • Vanderghast,

    The control is in the main form and is referenced by the subform. I tried the immediate window but it did not work. "? Forms!4m_Foorm!4m_Body_Area_ID". I got a Type-declaration character does not match declared data type Compile Error. This is a seperated data base with the data stored seperately. It has worked until recently. I just added a new field to the 4_m table. Could this be releated to my problem. I think the references worked before this point but cannot be sure they may have only worked on the initial build of the form.

    Tuesday, August 21, 2012 3:10 PM
  • Try with [ ]  around the names which elected to start with a digit for their name  :-)
    Tuesday, August 21, 2012 3:15 PM
    Moderator
  • OK it works with "? [Forms]![4m_Form]![Body_Area_ID]". What is more the form works after I do this. What is bad is that the next time I close and open the database it does not work until I run the command in the VB editor, but after that it works again. Any ideas?
    Tuesday, August 21, 2012 3:27 PM
  • Additional Info: It does not matter if I run the command in the VB editor or not all I have to do is open it and the references work. I don't even have to open it while the 4m form is open, If I open it beforethe 4m_form (Main Form) is open the it still works, if I don't open the VB editor no matter how many times I open the 4m_Form the references do not work.
    Tuesday, August 21, 2012 3:57 PM
  • Can you rename your form to a legal name, something like:  rh4mForm ( rh for your initials, and I also removed the _ which is used internally by VBA, such as to define an event handling procedure, or classes (like   4m_form_form   ?!  ) ... Not a good idea to use them.

    • Marked as answer by Reb Hodgson Tuesday, August 21, 2012 4:21 PM
    Tuesday, August 21, 2012 4:12 PM
    Moderator
  • That did it. Thanks

    Tuesday, August 21, 2012 4:21 PM