Page 3 of 3 FirstFirst 123
Results 31 to 40 of 40
  1. #31
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430

    how about option explicit, then compile the code?

  2. #32
    usertest is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2023
    Posts
    35
    Thanks for the update.

    I did the debug.printing as you suggested.
    I added option explicit on the modules as well
    Yes, I have used DoCmd.SetWarnings True for other codes as well
    It printed all the expected values in the Intermediate window.
    Correct SQL, Data connection, record name and value.
    But it only printed the top record from the dataset. Like the 1st row from the 15 rows in the intermediate window. But not on the form.

    You can use #12 post as source of truth.


    Quote Originally Posted by CJ_London View Post
    @usertest

    you really make it difficult to understand what you have.

    Original post had code commented out - subsequently corrected but you said happened in error
    you say query worked fine but clearly could not with the extra comma and no space - but you said it worked
    it's taken you nearly 20 posts before you answered some of the questions
    in post #7 you say r.recordcount returns a value of 15 - which I struggle to believe since the sql code you have provided simply would not work
    in the same post you say 'As this is a file that is given to me, I have not changed anything. It works fine on the other user's machine.'
    in post #9 you show 'the actual code' - and r.recordcount would still not work because the sql is still wrong
    in post #12 you show a different 'actual code', with some redaction for an unknown reason - but at least now the sql looks viable to run
    in post#16 you show what looks like made up code, unless you really have a server called ABC and a db called xyz?
    You keep saying it works on other machines - but I suspect you mean something similar since so far nothing you have shown is viable except perhaps post #12, with a question mark over the connection

    I strongly recommend you use Option Explicit at the top of every module because without it, this statement

    is meaningless. Without it, compile errors will occur at runtime - and based on what you have shown so far I can pretty much guarantee you will get compile errors since I can see at least one bit of code that won't compile


    this line


    implies DataConnection is a class library - so per you post #16 - are they the correct server and db names?

    To answer your question

    No, tho' always a good idea for any sub of function that could generate errors. What I mean was have you usedDoCmd.SetWarnings Trueanywhere in your code, not just the bits you are showing.


    If you have, then all error messages are suppressed until you turn it off again.

    recommend you do some more debug.printing

    dc.cps_assignment_date
    r.fields(0).name
    r.fields(1).name
    r.fields(2).name
    r.fields(0).value
    r.fields(1).value
    r.fields(2).value

  3. #33
    usertest is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2023
    Posts
    35
    I just had my other colleague run the database file and over there, she can see the data being populated as expected.

    So my file is not showing data in my system but running fine on her system. Seems strange :|

  4. #34
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    going back right to the beginning - the #Name error is caused when the controlsource cannot be found in the recordsource. So either the names in your controlsources are wrong or the recordset is wrong.

    It printed all the expected values in the Intermediate window.
    it would be helpful to see that since you now have a reputation for saying one thing and meaning another

    But it only printed the top record from the dataset. Like the 1st row from the 15 rows in the intermediate
    that is because the the recordset is sitting on the first record

    I just had my other colleague run the database file and over there, she can see the data being populated as expected.
    which means what? the form is being populated or the recordset? And did she run your file? or her own?

  5. #35
    usertest is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2023
    Posts
    35
    1: I tried to match the control source name with the name of the columns that are part of the SQL
    2: When you asked me to print the following
    .fields(0).name
    r.fields(1).name
    r.fields(2).name
    r.fields(0).value
    r.fields(1).value
    r.fields(2).value

    It only printed the 1st row of the 15 rows

    3: She opened my file and ran the query and it showed all 15 rows in the form.



    Quote Originally Posted by CJ_London View Post
    going back right to the beginning - the #Name error is caused when the controlsource cannot be found in the recordsource. So either the names in your controlsources are wrong or the recordset is wrong.

    it would be helpful to see that since you now have a reputation for saying one thing and meaning another

    that is because the the recordset is sitting on the first record

    which means what? the form is being populated or the recordset? And did she run your file? or her own?

  6. #36
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Of course Debug.Print only prints from first record as that is record that has focus. Would have to loop recordset to get all to print out.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #37
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    You seem incapable of providing anything to help us help you solve your problem so I’m going to drop off this thread.

    good luck, perhaps June will persevere

  8. #38
    usertest is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2023
    Posts
    35
    I responded to your questions on #35.
    But thanks for your help otherwise. Much appreciated for your earlier responses and insights.

    Quote Originally Posted by CJ_London View Post
    You seem incapable of providing anything to help us help you solve your problem so I’m going to drop off this thread.

    good luck, perhaps June will persevere

  9. #39
    usertest is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2023
    Posts
    35
    Ok got it, thanks for that. makes sense.
    So debug print
    Code:
    .fields(0).name
    r.fields(1).name
    r.fields(2).name
    r.fields(0).value
    r.fields(1).value
    r.fields(2).value
    
    does populate values as expected in the intermediate window but not on the form itself.
    I checked the control source that matches the name of the column in query and name provided in the control source of the field property, they match as well.

    Quote Originally Posted by June7 View Post
    Of course Debug.Print only prints from first record as that is record that has focus. Would have to loop recordset to get all to print out.

  10. #40
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    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

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 12-26-2017, 02:00 PM
  2. Replies: 2
    Last Post: 03-08-2015, 01:47 PM
  3. Replies: 15
    Last Post: 04-16-2014, 01:15 PM
  4. Form Field showing all table fields
    By DMJ in forum Forms
    Replies: 7
    Last Post: 03-25-2014, 03:57 PM
  5. fields not showing up in Form view
    By eroy in forum Forms
    Replies: 3
    Last Post: 08-28-2010, 05:44 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