oldcitycat
Board Regular
- Joined
- Sep 23, 2011
- Messages
- 71
First and foremost this is my first attempt at using a recordset!
With that in mind I did my researched and thought I understood but this issue has me stumped.
The code works up to rs.edit statement
I have verified that the If statement is true by stepping through the code,
When it gets to the rs.edit it jumps to end if, No error messages
The one thing I unsure of is if the recordset is locked by default when opened.
Sample Data
<tbody>
</tbody>
Thank you in advance for any and all suggestions
OldCitCat
With that in mind I did my researched and thought I understood but this issue has me stumped.
The code works up to rs.edit statement
I have verified that the If statement is true by stepping through the code,
When it gets to the rs.edit it jumps to end if, No error messages
The one thing I unsure of is if the recordset is locked by default when opened.
Code:
Sub CodeTesting()Dim db As Database
Dim rs As DAO.Recordset
Dim strNotes As String
Dim strOrderNumber As String
Set db = CurrentDb
Set rs = db.OpenRecordset("DailyMopOrds")
rs.MoveFirst
Do Until rs.EOF
If rs!Notes <> " " Then
strNotes = rs!Notes
strOrderNumber = rs!OrderNumber
rs.MoveNext
End If
If rs!Notes = "" And rs!OrderNumber = strOrderNumber Then
rs.Edit
rs!Notes = strNotes
rs.Update
End If
rs.MoveNext
Loop
End Sub
Sample Data
OrderNumber | OrderDate | PONumber | Notes | |
M5014365 | 2/27/2017 | AF373C/MAR17 | ****MARCH ORDER SHIP AFTER THE 1st*** | |
M5014365 | 2/27/2017 | AF373C/MAR17 | ||
M5014366 | 2/27/2017 | AF0C70/MAR17 | ***MARCH ORDER SHIP AFTER THE 1st** | |
M5014367 | 2/27/2017 | AF1510/APR17 | ****APRIL ORDER PLEASE SHIP AFTER 4/1**** | |
M5014367 | 2/27/2017 | AF1510/APR17 |
<tbody>
</tbody>
Thank you in advance for any and all suggestions
OldCitCat