Results 1 to 10 of 10
  1. #1
    unixhd is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    6

    Run-time error 2580 + other issues, including Access not recognizing the input i have set

    Hello,
    I have been trying to fix this for ages now.


    So, what I am trying to do here is to filter this subform using a drop-down menu (maybe an input field will be a better idea) and when I apply the filter I get this run-time error 2580. It says that the record source does not exist. I believe it is because Access does not recognize the input from the combo-box (drop-down) as an Int. But after chaning it to Int it did not work again.


    The code :
    Private Sub Combo502_AfterUpdate()Dim lenghty As String
    lenghty = "select * from dbo_m4_bolts_subform where([m4_lenght]=" & Me.Combo502 & ")"
    Me.dbo_m4_bolts_subform.Form.RecordSource = lenghty
    Me.dbo_m4_bolts_subform.Form.Requery
    End Sub
    Attached Thumbnails Attached Thumbnails photo_2021-09-10_18-54-12.jpg   photo_2021-09-10_18-54-02.jpg  

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Judging from the field alignment in your screen shot I'd say the field is set as (short) text in the table, not a number, so you need to wrap it in single quotes:
    Code:
    lenghty = "select * from dbo_m4_bolts_subform where [m4_lenght]='" & Me.Combo502 & "';" 'assumes the name of the table is dbo_m4_bolts_subform!!!!
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    unixhd is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    6
    Thanks for the response Gicu, I just tried what you suggested but it did not work. It gave me the same error. I just noticed that when i receive this error there is a "#Name?" in the field of m4_thread, could that be the issue?

  4. #4
    unixhd is offline Novice
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    6
    I just got a response from someone and they helped me solve it by reminding me that when selecting which fields to be searched I should set the source as the main table not a subform table.

    The answer :
    lenghty = "select * from dbo_m4_bolts where([m4_lenght]=" & Me.Combo502 & ")"

  5. #5
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    Hard to say just from a screen shot, maybe you can upload a small sample db (no sensitive data, just a couple "dummy" records to illustrate the issue). From the table prefix seems like you have a SQL server back-end, you could import just the table(s) needed by the form.

    Have you tried to bind the form to a query in which you make reference to the combo and in the AfterUpdate to simply leave just the last line (the subform requery)?

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  6. #6
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,235
    That was why I added the comment in my first post....
    Glad to hear you go it working, good luck with your project!
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,272
    Do you really have a table called subform?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    Quote Originally Posted by Welshgasman View Post
    Do you really have a table called subform?
    No - that's what the correction the OP made sorted out.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  9. #9
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Just in case somewhere down the road (e.g. in code) if you start to type 'length' instead of 'lenght', you'll have some issues.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,272
    The OP said he had a subform table?
    I was trying to see if that table actually has the word subform in it?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 5
    Last Post: 08-29-2019, 04:25 PM
  2. Run time error 2580: what does it mean?
    By peggy in forum Forms
    Replies: 4
    Last Post: 08-31-2018, 08:17 PM
  3. RUn Error 2580
    By Patricia Cruz in forum Access
    Replies: 2
    Last Post: 07-27-2017, 07:32 PM
  4. Run-time error '2580'
    By kd11 in forum Access
    Replies: 5
    Last Post: 06-07-2015, 08:34 AM
  5. Replies: 0
    Last Post: 02-22-2011, 04:18 PM

Tags for this Thread

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