Hi all,
I have no experience with this and sometimes I need more clarification in technical parts.
I have a select query with multiple tables as you can see in the attached image. I also have its SQL code here:
I need to have a combo box that its bound column sends the owner_ID. I need this query to list all the records where refer to given owner ID and all info (fName, lName, make, model, color and license plate) from other tables.
When I call this function in immediate window it shows 25 as number of rows (25 is the number of rows in another related table that is not called in this query). I was expecting to see the total number of rows (8 rows) in my query as it shows in "Datasheet view" when I run the query.
Please help.
I have no experience with this and sometimes I need more clarification in technical parts.
I have a select query with multiple tables as you can see in the attached image. I also have its SQL code here:
This is my first experience bringing SQL in VBA.Private Function someSQL()
sq = "SELECT tbl_customers.fName, tbl_customers.lName, tbl_carsOwners.car_year, tbl_makes.makes, tbl_models.models, " & _
"tbl_colors.color, tbl_carsOwners.lisencePlate, tbl_carsOwners.oilRange, tbl_carsOwners.owner_ID " & _
" FROM tbl_models " & _
" INNER JOIN (tbl_makes " & _
" INNER JOIN (tbl_customers " & _
" INNER JOIN (tbl_colors " & _
" INNER JOIN tbl_carsOwners " & _
" ON tbl_colors.color_ID = tbl_carsOwners.color_id) " & _
" ON tbl_customers.customer_ID = tbl_carsOwners.customer_id) " & _
" ON tbl_makes.makes_ID = tbl_carsOwners.make_id) " & _
" ON tbl_models.models_ID = tbl_carsOwners.model_id; "
Debug.Print rs.RecordCount
End Function
I need to have a combo box that its bound column sends the owner_ID. I need this query to list all the records where refer to given owner ID and all info (fName, lName, make, model, color and license plate) from other tables.
When I call this function in immediate window it shows 25 as number of rows (25 is the number of rows in another related table that is not called in this query). I was expecting to see the total number of rows (8 rows) in my query as it shows in "Datasheet view" when I run the query.
Please help.
Last edited: