You need to sign in to do that
Don't have an account?
BDArnz
For Each s In qr
For x = 1 To 25
MsgBox s.Fields(x).Name
Next x
Next s
Why does my query select ALL fields?
OK, this is driving me crazy! Maybe I'm doing something stupid but please help if you can.
No matter what I do with my query string, it ALWAYS returns ALL the fields. I thought the 'where' clause was going to be the challenge!
I'm running the following query:
Set qr = ThisWorkbook.cSFComm.Query("Select CreatedByID, CreatedDate, FirstName, Id From Contact", False)
I then loop through this code:
For Each s In qr
For x = 1 To 25
MsgBox s.Fields(x).Name
Next x
Next s
And can frustratingly watch it show me each and every field name from the table!
All the fields are “available” in a sobject, even though you only select a subset.
If you only want fields with value you can null check the field.Value.
Thank you for the quick response. I'm happy this forum is being monitored.
So if I understand correctly then, the select portion of the query statement is not fully functional??? If I wanted to query the contact object to obtain the first and last name of the contacts at account "XYZ company", I could not get just the first and last name fields.?. My app needs to filter out all the extraneous fields?
If that's the case, I can deal with it but it seems to be an awful lot of unused data going back and forth.
Thanks.
You actually only get data for the fields you request (likewise the toolkit only sends data back that has been modified).
The “unused” fields are there for reference as well has being fully functional, e.g. you can set values.