G
graeme34 via AccessMonster.com
Hi I have a yes/no flag I would like to update, I have had to build a temp
table to hold the yes/no box on the subform I'm using as the original query
wasnt updatable, now I have placed the following code on the On close event
of the main form:
Private Sub Form_Close()
Dim strSQL As String
Dim strSQLUpdate As String
Dim rs As Recordset
strSQL = "SELECT * FROM tblTempReceivePayment TRP " _
& "WHERE TRP.AccountName = " & "'" & Me.txtAccName _
& "'" & ";"
Set rs = CurrentDb.OpenRecordset(strSQL)
Do Until rs.EOF = True
If rs!SalesInvoicePaid = True Then
strSQLUpdate = "UPDATE tblSalesInvoice SI SET " _
& "SI.SalesInvoicePaid = True " _
& "WHERE SI.SalesInvoiceNumber = " & _
rs!SalesInvoiceNumber & ";"
End If
rs.MoveNext
Loop
End Sub
All I am trying to do is set the SalesInvoicePaid flag to true if the check
box control is ticked, I have debugged the code and it works fine even
entering the if statement, its just not updating the SalesInvoice table....???
table to hold the yes/no box on the subform I'm using as the original query
wasnt updatable, now I have placed the following code on the On close event
of the main form:
Private Sub Form_Close()
Dim strSQL As String
Dim strSQLUpdate As String
Dim rs As Recordset
strSQL = "SELECT * FROM tblTempReceivePayment TRP " _
& "WHERE TRP.AccountName = " & "'" & Me.txtAccName _
& "'" & ";"
Set rs = CurrentDb.OpenRecordset(strSQL)
Do Until rs.EOF = True
If rs!SalesInvoicePaid = True Then
strSQLUpdate = "UPDATE tblSalesInvoice SI SET " _
& "SI.SalesInvoicePaid = True " _
& "WHERE SI.SalesInvoiceNumber = " & _
rs!SalesInvoiceNumber & ";"
End If
rs.MoveNext
Loop
End Sub
All I am trying to do is set the SalesInvoicePaid flag to true if the check
box control is ticked, I have debugged the code and it works fine even
entering the if statement, its just not updating the SalesInvoice table....???