mscala
asked on
Editing MSHFlexgrid
Hi
I am using ADO to display information in a mshflexgrid. I am using this grid because a normal msflexgrid doesn't seem to work with and ADO Datacontrol. I am trying to edit a specific row in the grid before it is displayed. I am using the following code:
For i = 1 To cnt
Adodc1.Recordset.EditMode
Adodc1.Recordset.Fields("N o") = i
Adodc1.Recordset.Update
Adodc1.Recordset.MoveNext
Next
cnt is a counter which calculates the number of rows in the recordset.
It complains about EditMode, what am I doing wrong, how do I go about editing a specific column.
Another thing is how can you change the recordsource in the ADODC. It is set to "Select * from Table* but at a later stage I want to change that sql statement to something else, how do I do this? It doesn't seem to change the recordsource no matter what I try.
Please can someone help
Thanks!
I am using ADO to display information in a mshflexgrid. I am using this grid because a normal msflexgrid doesn't seem to work with and ADO Datacontrol. I am trying to edit a specific row in the grid before it is displayed. I am using the following code:
For i = 1 To cnt
Adodc1.Recordset.EditMode
Adodc1.Recordset.Fields("N
Adodc1.Recordset.Update
Adodc1.Recordset.MoveNext
Next
cnt is a counter which calculates the number of rows in the recordset.
It complains about EditMode, what am I doing wrong, how do I go about editing a specific column.
Another thing is how can you change the recordsource in the ADODC. It is set to "Select * from Table* but at a later stage I want to change that sql statement to something else, how do I do this? It doesn't seem to change the recordsource no matter what I try.
Please can someone help
Thanks!
ASKER
TimCottee
Hi, I am getting the following error when I refresh the adodc.
In the recordsource of the adodc : "Select * from Quotes"
IN my code where I want to change the recordsource I have the following:
Adodc1.RecordSource = "Select * From Quotes Where TenderNo = """ & SrchStr & """Order by Amount"
Adodc1.Refresh
On refresh it gives me the error:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Can you help please?
Thanks
Hi, I am getting the following error when I refresh the adodc.
In the recordsource of the adodc : "Select * from Quotes"
IN my code where I want to change the recordsource I have the following:
Adodc1.RecordSource = "Select * From Quotes Where TenderNo = """ & SrchStr & """Order by Amount"
Adodc1.Refresh
On refresh it gives me the error:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Can you help please?
Thanks
Use single quotes rather than double
Adodc1.RecordSource = "Select * From Quotes Where TenderNo = '" & SrchStr & "' Order by Amount"
Adodc1.RecordSource = "Select * From Quotes Where TenderNo = '" & SrchStr & "' Order by Amount"
ASKER
TimCottee
Perfect, you're a hero.
Thanks so much!
Just one thing, I am ordering my Amount. What I would like is for the amount to be ordered from highest to lowest, instead it is ordering from lowest to highest.
???
Perfect, you're a hero.
Thanks so much!
Just one thing, I am ordering my Amount. What I would like is for the amount to be ordered from highest to lowest, instead it is ordering from lowest to highest.
???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much for your help
Much Appreciated
Much Appreciated
ADODC1.RecordSource = "Select * From MyNewTable"
ADODC1.Refresh
This changes the sql statement for the recordset and refreshes the control.