Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Instead of using the Open Arguements, here's what I'll do:

    1. Open the form using the where clause and then 'push' the value into a field on the 2nd form or if I want certain code to execute based on this value, make it a function in a module or a Public function on the 2nd form and then call it after opening the form.

    ex:
    docmd.openform "Form2",,,"[Number to Copy] = " & me.[Number to Copy] & ""
    Forms!Form2!SomeFieldValue = me!SomeFieldValue
    Forms!Form2.RunSomePublicFunctionNameInForm2


    (or if I need to pass a value to the function)...
    Forms!Form2.RunSomePublicFunctionNameInForm2 (me!SomeField)

    or (to open Form2, add a new record and push the ID value to the field on form 2)...
    docmd.openform "Form2"
    docmd.gotorecord,,acnewrec
    Forms!Form2!ForeignIDField = me!IDField

    If I'm utilizing a foreign key on the 2nd form, I may also set the default value of this field to my 1st form (ie. =Forms!Form1!IDFieldName) I'll often set it up like this if it's a subform.

    As Allan mentioned, it doesn't make much sense to use the Open Arguements if you don't have other code in the 2nd form to do something with the value that is passed. I personally rarely use the Open Arguements.

  2. #17
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Quote Originally Posted by Douglasrac View Post
    Well I tried to make SubForms but its horrible. The automatic way makes the first form as it suppose to be and the second is a table. I don't want a table.
    To what have you set the Default View of the form you are displaying in the SubFormControl? You can display a SubForm in any view you want, not just Datasheet.

  3. #18
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Quote Originally Posted by pkstormy View Post
    Instead of using the Open Arguements, here's what I'll do:

    1. Open the form using the where clause and then 'push' the value into a field on the 2nd form or if I want certain code to execute based on this value, make it a function in a module or a Public function on the 2nd form and then call it after opening the form.
    This just may be a personal preference but I respectfully disagree. Using the OpenArgs encapsulates the function of the form within that form and is easier to understand and maintain years later. Just my $0.02

  4. #19
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Quote Originally Posted by Douglasrac View Post
    I just need help on how to change the command below, so access will understand which one is the correct field.

    Code:
    stLinkCriteria = "[Number to Copy]=" & Me![Number to copy]
    Or I need to change the name of that field, which seems impossible. Where can I see the real name of a field? Where can I change this name?
    The field is within the RecordSource of the next form.

  5. #20
    Douglasrac is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    92
    I don't understand why is so hard to make such a simple thing.

    I'm trying to create a button that will open a form with Design > Button menu. Then I choose open the form with a specific value. Then I have to choose which field is common between the forms. And the first from has no field, so how can I choose? I was working an now it's empty out of nothing.

    When I go to Add Existing Fields I can see all the fields of the table. So somehow, the form is connected to the table. So why when I go to create a button the fields doesn't appear?

  6. #21
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    I'm sorry but your last post makes very little sense to me.

  7. #22
    Douglasrac is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    92

    Thumbs up

    Quote Originally Posted by RuralGuy View Post
    I'm sorry but your last post makes very little sense to me.
    Means the wizard to add a button that will Open a form in a specific value is not working.

    Anyway, here is the solution I've being asking for, considering all the code I already posted, the parts to changes are:

    Code:
    strCriteria = "[Number to Copy_Table2] = " & Me.[Number to Copy_Table1]
    
    OpenArgs:=(Me.[Number to Copy_Table1])

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 11-17-2010, 05:21 PM
  2. Replies: 5
    Last Post: 11-12-2010, 12:10 PM
  3. Replies: 2
    Last Post: 02-26-2010, 08:14 AM
  4. Simple Nav Form Code Not Working
    By alsoto in forum Forms
    Replies: 10
    Last Post: 04-10-2009, 09:30 AM
  5. Replies: 0
    Last Post: 02-21-2008, 09:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums