Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update Qry

Posted on 2010-11-10
9
Medium Priority
?
416 Views
Last Modified: 2012-06-27
Experts,

I have a tblLetterOfCredit and it has some blank fields.
I need to update those blank fields based on another table I imported from Excel [tblExcelImport].
I can match between the two table on LCNo.

I think there are two ways to do this:  canned update qry in MSAccess or by code

~~~~~~~~~~~
Maybe it is easier to see In code (it would be something like this):
If [tblLetterofCredit][LCNo] matches [tblExcelImport][LCNo] then update APPLICANT on tblLetterOfCredit from [Applicant] in the excel file BUT ONLY IF LCNO UNDER TBLLETTEROFCREDIT IS BLANK.

I hope my explanation is clear enough and please ask if you have questions.
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 34106207
update [tblLetterofCredit],[tblExcelImport]
set [tblLetterofCredit].APPLICANT = [tblExcelImport].APPLICANT
where nz([tblLetterofCredit].APPLICANT,"") = ""
  AND [tblLetterofCredit].[LCNo] = [tblExcelImport].[LCNo]

I think you mean

BUT ONLY IF __APPLICANT__ UNDER TBLLETTEROFCREDIT IS BLANK.
0
 

Author Comment

by:pdvsa
ID: 34106386
OH YES...that is right I did mean Applicant.  Thanks for that.  Let me test it.  I did not include all and so I need to use what you said and modify it a little.  
0
 

Author Comment

by:pdvsa
ID: 34113749
I get an error of "type conversion failure.  I wonder if this could be becuase the field I am trying to update is a combobox ([tblLetterofCredit].APPLICANT).  I remember now that I tried doing this before and ran into the same issue.  

What do you think?
untitled.JPG
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 58

Expert Comment

by:cyberkiwi
ID: 34114500
Is Applicant the only field that is being updated?
Please list the fields and types being updated to/from on both tables.
I think you need a conversion somewhere.
0
 

Author Comment

by:pdvsa
ID: 34117737
Yes, Applicant is the only field being updated.  The property is Number with a row source qry in it on tblLetterOfCredit.  It is acombobox.  

On tblExcelImport, applicant is text.  

(doing this from memory). Pretty sure it is correct.  

Any ideas?   Thanks
0
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 34118630
The source from tblExcelImport may have invalid number, or some fields that are blank strings.
You can try this

update [tblLetterofCredit],[tblExcelImport]
set [tblLetterofCredit].APPLICANT = [tblExcelImport].APPLICANT
where nz([tblLetterofCredit].APPLICANT,"") = ""
  AND [tblLetterofCredit].[LCNo] = [tblExcelImport].[LCNo]
  AND val("0" & [tblExcelImport].APPLICANT) <> 0

It will omit all the invalid tblExcelImport.Applicant values
0
 

Author Comment

by:pdvsa
ID: 34145449
will try to get to this today....thx...  
0
 

Author Comment

by:pdvsa
ID: 34151756
cyberkiwi:  how could I modify it to update where LCNo = LCNo from both tables?
0
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 2000 total points
ID: 34151937
Doesn't this condition cover it?

  AND [tblLetterofCredit].[LCNo] = [tblExcelImport].[LCNo]
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question