Jumat, 21 Juni 2019

[MS_AccessPros] Update table using a recordset

 

Hi,


The intent of the code below is to update 3 values in the table "tblAllPols" based on the values found in the variable strsql1.  I am getting the correct rows when I run through the code in the "For inti........" statement but it's just not updating the table with the InvoiceNo, Date and Currency.


Set dbs = CurrentDb

strsql1 = "SELECT tblAllPols.SeqNo FROM tblAllPols WHERE [tblAllPols].[Issuedate] = # " & vard & " #" & vno & add2 & add3 & add4 & add8

strSQL = "SELECT * from [tblAllPols]"

Set rst = dbs.OpenRecordset(strSQL)

Set rst1 = dbs.OpenRecordset(strsql1)

rst1.MoveLast

rst1.MoveFirst


noorecords = rst1.RecordCount

For inti = 0 To (noorecords - 1)

        burgarray(0, inti) = rst1!SeqNo

        rst1.MoveNext

    Next


saverec = MsgBox("Do you want to save this record?", vbYesNo)

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70


If saverec = vbYes Then

For inti = 0 To (noorecords - 1)

    With rst

        .Edit

        !InvNo = Me!InvoiceNo

        !InvDate = Me!Date

        !Currenc = Me!Currency

        .Update

    End With

Next

 rst.Close

 rst1.Close

    

    

End If


Any assistance would be greatly appreciated


Regards

Toukey


__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar