Page 1 of 2 12 LastLast
Results 1 to 15 of 22

Thread: Odd error 3001

  1. #1
    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    10

    Unhappy Unanswered: Odd error 3001

    I use the following code to synchronise the data on a parent form with the data on a subform as I move through the records of the subform. The code is run on the "on current" event of the subform. Most of the time the code works fine BUT....
    When I use the built in Access "find" function to find a specific record on the parent form this code crashes at the "findfirst" statement with an error 3001 invalid argument error.
    The variable Claim_ID is a primary key and cannot be null.
    Please help.

    Dim frmrst As DAO.Recordset
    Dim Sync As String
    Dim sync91 As String

    Set frmrst = Form_F4_Edit_Claims.RecordsetClone
    frmrst.MoveLast
    frmrst.MoveFirst

    sync91 = BuildCriteria("Claim_ID", dbInteger, Form_F4_Claim_Pmts.Claim_ID)
    Sync = sync91
    frmrst.FindFirst Sync

    'This is the statement which makes the record required the current record of the form.
    Form_F4_Edit_Claims.Bookmark = frmrst.Bookmark

  2. #2
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238

    Re: Odd error 3001

    Originally posted by MagidyPie
    I use the following code to synchronise the data on a parent form with the data on a subform as I move through the records of the subform. The code is run on the "on current" event of the subform. Most of the time the code works fine BUT....
    When I use the built in Access "find" function to find a specific record on the parent form this code crashes at the "findfirst" statement with an error 3001 invalid argument error.
    The variable Claim_ID is a primary key and cannot be null.
    Please help.

    Dim frmrst As DAO.Recordset
    Dim Sync As String
    Dim sync91 As String

    Set frmrst = Form_F4_Edit_Claims.RecordsetClone
    frmrst.MoveLast
    frmrst.MoveFirst

    sync91 = BuildCriteria("Claim_ID", dbInteger, Form_F4_Claim_Pmts.Claim_ID)
    Sync = sync91
    frmrst.FindFirst Sync

    'This is the statement which makes the record required the current record of the form.
    Form_F4_Edit_Claims.Bookmark = frmrst.Bookmark
    I don't think you can use the BuildCriteria() function with form controls... Try this...

    frmrst.FindFirst "[Claim_ID] = " & [Form_F4_Claim_Pmts].[Claim_ID]

  3. #3
    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    10

    Unhappy

    Thanks for the suggestion but unfortunately it didn't work. I still get the same error.
    Any other suggestions will be hugely appreciated since I am getting a bit desperate.
    Caroline

  4. #4
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by MagidyPie
    Thanks for the suggestion but unfortunately it didn't work. I still get the same error.
    Any other suggestions will be hugely appreciated since I am getting a bit desperate.
    Caroline
    Okay... Let's try something else...
    1)What data type is the Client_ID? ...I was assuming numeric...
    2) Are you absolutely sure that the Client_ID field exists with the same name in both of the recordsources?

  5. #5
    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    10

    Red face

    Client ID is a long integer. It is part of a compound key in the record sources behind each form.
    The forms are linked via this field as well.
    It is possible that when I search for a record on the parent form that there will be no matching record in the subform.
    There is a many to one relationship between the table behind the parent form and the table behind the sub form.
    I have tried using

    frmrst.filter = sync

    which seems to work but then I don't seem to be able to turn the filter off. is "FilterOn" not available on a DAO recordset.

    Thanks again
    Caroline

  6. #6
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by MagidyPie
    Client ID is a long integer. It is part of a compound key in the record sources behind each form.
    The forms are linked via this field as well.
    It is possible that when I search for a record on the parent form that there will be no matching record in the subform.
    There is a many to one relationship between the table behind the parent form and the table behind the sub form.
    I have tried using

    frmrst.filter = sync

    which seems to work but then I don't seem to be able to turn the filter off. is "FilterOn" not available on a DAO recordset.

    Thanks again
    Caroline
    Yes it is... Whenever you want to apply the filter you need two lines of code...

    frmrst.Filter = sync
    frmrst.FilterOn = True

    When you want to remove it... you just need...

    frmrst.FilterOn = False

  7. #7
    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    10
    Oh Bother!
    The FilterOn statement gives me a method not found error.
    Hmmm, I wonder if there is a patch I need. Or could the order I have my references set impact on this? My DAO reference is at the bottom of the list. I would have thought the fact that I have defined the recordset as DAO should sort that out.
    Any more thoughts??
    Caroline

  8. #8
    Join Date
    Feb 2004
    Posts
    199
    which version of DAO do you use (see in the Refernces)

  9. #9
    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    10
    DAO 3.6

  10. #10
    Join Date
    Feb 2004
    Posts
    199
    there is no FilterOn method in DAO3.6
    you should use this way

    rst.filter=criteria
    set rst1=rst.openrecordset

    and you get rst1 filtered

    as I see this way isn't solution for your problem, but why dont you filter form instead of filtering form's recordsetclone?

  11. #11
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by Kakha
    there is no FilterOn method in DAO3.6
    you should use this way

    rst.filter=criteria
    set rst1=rst.openrecordset

    and you get rst1 filtered

    as I see this way isn't solution for your problem, but why dont you filter form instead of filtering form's recordsetclone?
    k... Maybe I'm braindead this morning... but what the heck does DAO have to do with the FilterOn PROPERTY of the form or report??

    This is not a method... This is nothing to do with whether you are using ADO or DAO... This is a simple form property that access has in every version I've seen??

  12. #12
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by MagidyPie
    DAO 3.6
    OOOhhhh... Wait a minute...

    I saw your name "frmrst" and because of the frm prefix I thought this was a form name... That's what you need to use... Not a recordset object...

  13. #13
    Join Date
    Feb 2004
    Posts
    199
    why dont you filter form instead of filtering form's recordsetclone?
    that was my question

  14. #14
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by MagidyPie
    Oh Bother!
    The FilterOn statement gives me a method not found error.
    Hmmm, I wonder if there is a patch I need. Or could the order I have my references set impact on this? My DAO reference is at the bottom of the list. I would have thought the fact that I have defined the recordset as DAO should sort that out.
    Any more thoughts??
    Caroline
    Okay... I really am not doing well so far today... lol... Let's get back to basics here... lol... I went back and re-read the original post...

    You have a main or parent form... and a sub or child form...
    You want to filter the main form according to what record is selected in the subform correct??

  15. #15
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by Kakha
    that was my question
    LOL... Smart idea! ...and that's what we're going to do...

Posting Permissions

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