Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys. I have the following tables in an Access database:
Customer
CustomerID | Name | Active? |
123 | Bob smith | Yes |
444 | John Jones | Yes |
990 | Ed Johnson | No |
087 | Paul Crisp | Yes |
Address
CustomerID | Address |
123 | 1 Shakespeare Road, Bedford. |
444 | 5 Dudley Street, Bedford |
990 | 9 Holly View, Sowerby Bridge |
087 | 18 Church Lane, Ravensden |
I would like to import only customers who are active. The problem with this is that if I tell the code to import only active from the customer table, it still imports the inactive information (customer 990) from the address table. Can anyone suggest anything?
My basic code is as follows:
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *
FROM [Customer];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *
FROM [Address];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *
FROM [Customer];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
load *
where exists ( CustomerID ) ;
SQL Select *
FROM [Address];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
SQL Select *
FROM [Customer];
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
load *
where exists ( CustomerID ) ;
SQL Select *
FROM [Address];
Hi,
Isn't it possible to add a where clause similar to:
Active='Yes'
And check the result?
When i try this i get
SQL##f - SqlState: 07001, ErrorCode: 4294964286, ErrorMsg: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
SQL Select *
FROM [Customer]
Where [Active] = 'Yes'
Hi,
Here both ODBC connections are same so no need to write connection string two times
ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\u22471\Desktop\QV\New Microsoft Access Database.accdb];
Customers:
SQL Select *
FROM [Customer] where Active<>'No';
inner join(Customers)
Address:
SQL Select *
FROM [Address];
Use :
where condition for Active column.
where Active ='Yes'
Maybe:
SQL Select *
FROM [Customer]
Where [Active?] <> 'No'
When i run this code i get
SQL##f - SqlState: 07001, ErrorCode: 4294964286, ErrorMsg: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Customers:
SQL Select *
FROM [Customer] where Active<>'No'
Is the field name correct [Active?]
Sorry, i changed it to [Active] because i was worried the question mark was causing the issue which it wasnt