Jumat, 05 Agustus 2011

[MS_AccessPros] Code to update table

 


I have a form with a button when pressed would lookup a table for the seqno. The code worked fine until the "where clause" in the code below can now exist in more than one row.

How can I amend the code so that the InvDate and InvNo is populated in the other rows?

This is the condensed version of the code:

Dim uquery As String
Dim uquery1 As String
Dim sno As Long

vard = Me!IssueDate
add2 = " And [tblAllPols].[PolicyNo] = '" & vary & " ' "
add3 = " And [tblAllPols].[Premium] = " & varz
add4 = " And [tblAllPols].[ClientNo] = " & xx
vno = " And [tblAllPols].[InvNo] = 0"
add8 = " And [tblAllPols].[Tax] = " & varp

sno = DLookup("[SeqNo]", "tblAllPols", "[tblAllPols].[Issuedate] = # " & vard & " #" & vno & add2 & add3 & add4 & add8)

uquery = "update tblAllPols set InvDate = # " & varx & " # where [tblAllPols].[SeqNo] = " & sno
uquery1 = "update tblAllPols set InvNo = " & x & " where [tblAllPols].[SeqNo] = " & sno

Regards
Toukey

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar