Results 1 to 6 of 6
  1. #1
    Budatlitho is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2016
    Posts
    36

    Syntax for field name in recordset

    Hello!

    I have a table field named "Participant Member Number (7-digits)"

    I want to refer to it in an open recordset like this:
    Code:
     amountdue = DSum("[Order amount]", "Jumbula", _
                "[Participant Member Number (7-digits)] =""" & eid & """")
    What is the proper syntax for this field name?
    Debug gives "Run-time error "3265':


    Item not found in this collection"


    Thanks in advance.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    How do you know which is not found, Participant or eid? If eid is a number try
    DSum("[Order amount]", "Jumbula", "[Participant Member Number (7-digits)] = " & eid)

    That field name is awful. You should avoid any special characters (except possibly underscore) in object names.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Further to Micron's suggestion, I would add -- no spaces in field names.

    You should post the complete code involved and also where exactly the error occurs.
    You could also show us the design of table Jumbula

    Use Debug.print "amount Due " & amountdue to show the value.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by Budatlitho View Post
    Hello!

    I have a table field named "Participant Member Number (7-digits)"

    I want to refer to it in an open recordset like this:
    Code:
     amountdue = DSum("[Order amount]", "Jumbula", _
                "[Participant Member Number (7-digits)] =""" & eid & """")
    What is the proper syntax for this field name?
    Debug gives "Run-time error "3265':
    Item not found in this collection"


    Thanks in advance.
    You don't have to have a field name like that. You can have a caption for the field that is like that if you have to have such a long name
    I never had any spaces in any field names. I used captions a fair bit.
    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

  5. #5
    Budatlitho is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2016
    Posts
    36
    Thanks for the suggestion.

    How do I implement captions?

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    In the table to have them everywhere.
    Or in the label of the control.
    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. Wrong syntax on DOA.Recordset field update
    By GraeagleBill in forum Programming
    Replies: 11
    Last Post: 08-12-2021, 09:57 AM
  2. DAO recordset field reference syntax
    By GraeagleBill in forum Programming
    Replies: 3
    Last Post: 04-23-2016, 06:02 PM
  3. syntax error on Recordset
    By jtm013 in forum Programming
    Replies: 1
    Last Post: 07-09-2015, 02:17 PM
  4. Syntax Error Help with Recordset
    By ajetrumpet in forum Programming
    Replies: 11
    Last Post: 09-08-2010, 02:39 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