I was actually able to find what I think is a good solution to this problem in another discussion forum. Here is the updated code, which sets a range of just the rows that meet the needed conditions, then deletes that range, leaving behind the remaining rows:
For i = LastRow To 3 Step -1
If...
I have some code containing a for next loop, which loops through the rows in my range in reverse from bottom to top, and conditionally deletes entire rows from my range, if condition 1, 2, 3, 4 or 5 are true. There is about 4,000 rows in my range of data. This section of the code is taking about...
Andy, here is the code I used to bookmark just the records I selected in the datagrid, to only update those bookmarked records, identifying them in the SQL update statement by their ID:
Private Sub cmdMarkSelected_Click()
10 On Error GoTo cmdMarkSelected_Click_Error
20 If cboMarkAs.Text...
No worries Andy, I think ADODB will actually work great - so for in the testing I've done, using ADODB has eliminated the speed issues I was running into ADODC. I was able to use your ADODB code example to update all the records in my recordset, or update just one single record which I selected...
Although I wish I could just do this, I don't think this will work, because in my application, the user is manually selecting specfic rows in the datagrid they want to update. If you look back at the code I originally posted, those selected rows are getting bookmarked, and it is those...
Thanks Andy, this works as well - so then using ADODB what would be the proper syntax to update fields in the recordset, in order to update my database? Using ADODC I'm doing something like this for example:
adodc1.recordset.fields(0).value = "some value"
adodc1.update
adodc1.refresh...
Andy, I apologize for my delay in replying. This should work, but for starters, I need some help on how to populate my datagrid with the data from ADODB recordset. Using ADODC, my code looks like this:
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
What would the correct syntax be...
Andy sorry for the delay in responding - I have no problem in using ADODB instead of ADODC, however I would definitely need some help in re-writing the code to use ADODB instead, including my code in other parts of the project that connect to the server and open the database in the first place...
Andy, I was wondering if that error was happening because my recordset I'm trying filter wasn't set to anything. So I decided to try inserting a new line of code:
Adodc3.Refresh
right after the line of code Adodc3.RecordSource = "SELECT paid, datePaid, comment, ID FROM c_CommPaid"
Now with...
No, I do not. When I do what you mentioned above, my program opens, and then in my form I select the records and click the command button in my program that triggers this procedure to run, and that is when I get the runtime error.
If I start from within the project with full compile (ctrl+F5), the same thing happens, I get the error at run time when it gets to that line I mentioned above.
I do not get the error when I compile the code, I am just running the code from within my project, and at runtime I am getting error on the 'Adodc3.Recordset.Filter = "ID = " & cID line'. When I compile the code I do not receive a compile error, however I get the same runtime error when I run...
Sorry I missed that piece - when I type 'adodc3.recordset.', I am able to select 'Filter' from the intellisense drop down list.
When I insert the msgbox line in the code, i get 'ID = 46942', 46942 is the ID in the database for the first record I had selected in the data grid.
Hi Andy - I'll be honest, trying to declare that string function as a variable did have me scratching my head. You are correct, the ID is a long integer, and it is in the 7th column of the data grid. I have removed the str function from the line of code, and here is my code as I have it now...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.