Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I tried to merge 3 tables it working fine till adding address column of third table. If i add address column and save or click Data Sheet view suddenly Access table stop working and restarts.

This is my code i working as parameter but if i give correct column name it showing error. Help me to complete my task.

C#
SELECT RPT_Invoice_Less.InvoiceNumber, RPT_Invoice_Less.Terms, 
RPT_Invoice_Less.Invoicedate, RPT_Invoice_Less.OurQuote, 
RPT_Invoice_Less.SalesPerson, RPT_Customer.CustomerName, 
RPT_Customer.CustomerId, RPT_Customer.ContactPerson, 
RPT_Customer.BillingAddress, RPT_Customer.DeliveryAddress, 
RPT_Invoice_Less.OrderNumber, RPT_Invoice_Less.ShippingBy,
RPT_Invoice_Less.ShipReferenceNo, RPT_Invoice_Less.Notes, 
RPT_Invoice_Less.Price, RPT_Invoice_Less.Discount, RPT_Invoice_Less.Shipping, 
RPT_Invoice_Less.Tax, RPT_Invoice_Less.GrandTotal, RPT_OrionSystem.CompanyName, 
RPT_OrionSystem.CompanyId, RPT_OrionSystem.RegistrationNumber, 
RPT_OrionSystem.Address1, RPT_OrionSystem.MobileNumber, 
RPT_OrionSystem.FaxNumber, RPT_OrionSystem.CompanyEmail, 
RPT_OrionSystem.CompanyWebsite, RPT_OrionSystem.VatTinNumber

FROM (RPT_Invoice_Less 

INNER JOIN RPT_Customer ON RPT_Invoice_Less.CustomerId=RPT_Customer.CustomerId) 
INNER JOIN RPT_OrionSystem ON RPT_Invoice_Less.CompanyId=RPT_OrionSystem.CompanyId;


In the 11th line
RPT_OrionSystem.Address1
is parameter if I give correct column name
RPT_OrionSystem.Address<pre> MS Access stop working.
Posted

1 solution

Hi Thanks to all, Finally I solved this using this code

SQL
SELECT RPT_Invoice_Less.InvoiceNumber, RPT_Invoice_Less.Terms, RPT_Invoice_Less.Invoicedate, RPT_Invoice_Less.OurQuote, RPT_Invoice_Less.SalesPerson, RPT_Customer.CustomerName, RPT_Customer.CustomerId, RPT_Customer.ContactPerson, RPT_Customer_Address.BillingAddress, RPT_Customer_Address.DeliveryAddress, RPT_Invoice_Less.OrderNumber, RPT_Invoice_Less.ShippingBy, RPT_Invoice_Less.ShipReferenceNo, RPT_Invoice_Less.Notes, RPT_Invoice_Less.Price, RPT_Invoice_Less.Discount, RPT_Invoice_Less.Shipping, RPT_Invoice_Less.Tax, RPT_Invoice_Less.GrandTotal, RPT_Company.CompanyName, RPT_Company.CompanyId, RPT_Company.RegistrationNumber, RPT_Company_Address.Address, RPT_Company.MobileNumber, RPT_Company.FaxNumber, RPT_Company.CompanyEmail, RPT_Company.CompanyWebsite, RPT_Company.VatTinNumber

FROM (((RPT_Invoice_Less 
INNER JOIN RPT_Customer 
ON RPT_Invoice_Less.CustomerId = RPT_Customer.CustomerId) 

INNER JOIN RPT_Company 
ON RPT_Invoice_Less.CompanyId = RPT_Company.CompanyId) 

INNER JOIN RPT_Company_Address 
ON RPT_Invoice_Less.CompanyId = RPT_Company_Address.AddressId) 

INNER JOIN RPT_Customer_Address 
ON RPT_Invoice_Less.CustomerId = RPT_Customer_Address.CustomerId;
 
Share this answer
 
Comments
Ankur\m/ 4-Feb-14 6:26am    
Please highlight what change you did and how it solved the issue. And then accept the answer.
srihari1904 17-Mar-14 1:08am    
Hi, More Sub-Query in first SQL Query that's why that code getting error so to solve that I remove address separately from Company and Customer Table and Add that finally by INNER JOIN.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900