how about option explicit, then compile the code?
how about option explicit, then compile the code?
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.
@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
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 :|
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 anotherIt printed all the expected values in the Intermediate window.
that is because the the recordset is sitting on the first recordBut it only printed the top record from the dataset. Like the 1st row from the 15 rows in the intermediate
which means what? the form is being populated or the recordset? And did she run your file? or her own?I just had my other colleague run the database file and over there, she can see the data being populated as expected.
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.
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?
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.
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
I responded to your questions on #35.
But thanks for your help otherwise. Much appreciated for your earlier responses and insights.
Ok got it, thanks for that. makes sense.
So debug print
does populate values as expected in the intermediate window but not on the form itself.Code:.fields(0).name r.fields(1).name r.fields(2).name r.fields(0).value r.fields(1).value r.fields(2).value
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.
Now crossposted at https://www.access-programmers.co.uk...m-name.329248/
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