Rabu, 16 November 2016

Re: [MS_AccessPros] Help with table update

 

Toukey-


Rather than look up a single sequence number, I would think you would simply run your UPDATE query to update all records that match on client number and whatever is the "type" field you mentioned earlier.

uquery = "update tblAllPols set InvDate = # " & varx & " # where [tblAllPols].[ClientNo] = " & xx & " AND type = " & ???


John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Nov 16, 2016, at 2:14 PM, toukey1 <no_reply@yahoogroups.com> wrote:



The fields are different to what I sent initially but this below is an extract of what is being used now.  Some very old code I might add.



xx = Me!ClientNoCombo.Column(0)
varx = Me!Date
vard = Me!IssueDate
vary = Me!PolicyNo
varz = Me!Premium
varp = Me!Tax

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


---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

It would help to see your code.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Nov 15, 2016, at 9:02 PM, toukey1 <no_reply@yahoogroups.com> wrote:



Currently I have code that would look up a table and return the seqno where client and type matches what is entered on a form and update the inv and invdate with what is entered on the form. However, the code was written when there would only be one unique row. e.g.


seqno   client    type     ins    Inv    InvDate


001       123     Mtr      006    0



Now there is a requirement to update more than one row with the same Inv and InvDate where the client and type is the same (refer to below).  How do I go about this?


seqno   client    type     ins    Inv    InvDate


001       123     Mtr      006    0

002     123     Mtr      008    0


003       123     Mtr      009    0


Any assistance would be appreciated.


Regards








__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar