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:
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?
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.