Results 1 to 6 of 6
  1. #1
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71

    form as recordset

    I had developed my application on 2013 version originally and last year moved to 2016 version of Office.
    To pick up data from a form directly I was using following code without any problem:
    form_name of open form![name of sub-form].form.recordset
    I was able to cycle through the records using loop method without any problems.



    After moving to 2016 version, the same program is working without any problems.
    However, I am trying to use exactly the same method for another event in different project, and it gives error "424 - object required".
    I also tried to use for main form itself as recordset (no sub-forms) and same error comes up.
    Looks like VBA in 2016 accepts what was written earlier in 2013 but anything new gives error.
    I have checked everything carefully including property of the form, etc., but cannot get it working.
    Any ideas?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    if you are in a form , and have all the records there, why do you cycle thru the recordset? (use queries)

    Do you have some exotic control on the form? Usu when you upgrade, the odd controls dont get upgraded, (or do) and there is conflict.
    Like calendar control.... I get activeX errors in newer versions since I put the control on my form in 2007.
    remove this control.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Your method doesn't sound right.

    I would open a record set in code using the "recordsetclone" of the main form (sub form.)
    But hard to be specific without seeing the code......

  4. #4
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71
    Ranman and Ssanfu
    Tks for yr comments.
    Actually I have now avoided using the form recordset in the new programs by directly using query recordset which is working fine.
    Just for your reference, I will explain the 2 events where I was using the form recordset in the format as mentioned above:

    1. Main form has a combo-box to select company code from a list of overseas and local companies combined from 2 different tables.
    Sub-form shows the details of the company like address, etc.
    Recordsource and field data for the sub-form depends on whether it is local or overseas.
    On update event of the combo-box, if record-count in the sub-form with one recordsource is zero, then change the recordsource to the other one.
    There was no problem with this in the old version and also same program running in new version.
    But when I tried using this for a new project in new version, error was coming up as mentioned earlier.

    2. In another project, I am cycling through a different hidden form recordset to pick up some field values from its sub-form, to enter into current open form fields.
    This is working fine with the new version as well, but I have not tried this for any new project yet.

    If there are any ideas, please do share.
    Thanks again

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Quote Originally Posted by krag View Post
    Recordsource and field data for the sub-form depends on whether it is local or overseas.
    Reading the above, could your problem be caused by local variations in data formatting e.g. Dates in mixture of dd/mm/yyyy and mm/dd/yyyy or decimal points using both dots and commas?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    krag is offline Medium experience
    Windows 10 Access 2016
    Join Date
    May 2014
    Posts
    71
    ridders52
    Tks for the comment.
    Basically the structure and fields in the old project and new project for this particular event are very similar and almost copy-pasted and edited version.
    All the fields in the sub-form are string values.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 11-28-2015, 09:58 PM
  2. Replies: 4
    Last Post: 05-20-2014, 12:45 PM
  3. Replies: 6
    Last Post: 12-03-2013, 11:14 PM
  4. Replies: 2
    Last Post: 03-08-2012, 12:59 PM
  5. Replies: 1
    Last Post: 11-13-2009, 03:03 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