Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    3

    Cool Unanswered: Compatibility 2003-2007 RecordsGoToNew

    I have this form with tons of code that worked in 2003, but doesn't appear to work in 2007. The form has about 20-30 text boxes, about 6 subforms and one button. When the user clilcks the button, he is prompted to select a text file from the file system. After clicking okay, all the text in the text file is parsed into the various areas of the main form (either the text boxes or a subform). My parsing code is about 18 pages. When I run through the procedure, information is imported into the text boxes fine; the problem appears to be with the subforms. The error I get is:

    Run-time error '2046':

    The command or action 'RecordGoToNew' isn't available now

    RecordGoToNew is what I use after inporting data into a subform. Anytime I import multiple records into a subform I use this code, or very similar:

    Me.OnBoard_Devices.Form.Device = temp1
    Me.OnBoard_Devices.Form.RanAt = RanAt

    Me.Refresh
    Me.OnBoard_Devices.SetFocus
    DoCmdRunCommand acCmdRecordsGoToNew
    FYI- For some reason, dBforums is replacing "Ru" with "****" in the above code

    Is there a difference between access 2003 and 2007 in terms of how to go to a new record on a subform? Why does this one piece of code fail in 2007 but not 2003? Any help is appreciated.
    Last edited by Gunslingor; 07-21-09 at 09:20.

  2. #2
    Join Date
    Jul 2009
    Posts
    3

    A little more info

    All my subforms are supposed to be linked to my master form by the primary key "Hostname". All the text boxes on the main form are derived from tables that also have the "HostName" primary key. All the tables are things link IPaddress, macaddress, ports, programs, services, etc.

    Now, in 2003, to link my child and master forms, I simply put "hostname" in both the child and master fields and everything worked perfectly. When I first open the main form in 2007, it automatically changed the link master of all my subforms to "physicalports.hostname" which is the primary key of one of the tables that some of the text boxes come from but it is not the primary table of the form. It should have automatically assigned "Boxes.hostname" which is the table that list each host name only once. When I change it to this, I get the same error though.

    Does the master field need to be "boxes.form.hostname"? What's going on here?

  3. #3
    Join Date
    Jul 2009
    Posts
    3

    Resolved.

    The problem persisted, but it is solved. For anyone who needs to know, there were a variety of things wrong, some of which resulted from porting the program to access 2007 and others resulting from the fact that I haven't used this form in a while and changes had been made to related tables. A few notes:

    1. Master field links of subforms needed to be linked to the name (under the "other" tab of the property sheet) of the text box on the main form that is hostname of primary table. Access was trying to link the master fields to the table, but they should have been linked to the text box as they were in 2003.
    2. I added some fields to some tables. My subform's record source was set to all (*) of the source table; these fields shouln't have been there, but they shouldn't have caused this problem, yet, when removed from the subforms everything worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •