I will try to deal with my problem as best as possible and explain what I'm trying to achieve. Firstly, I have three tables:
**RFI** (stands for Request For Information)- Fields: rfi_id, Customer_id ..... **RFI_project** - Fields: rfipro_id, project_id, rfi_id *"....." represents other unnecessary fields* **Customer** - Fields: Customer_id, company .....
I have an access form with two comboboxes. In the first combo box, I select the name of the project in which the second text field changes to show these * rfi_id * where there is a match with the selected project name. Now I'm trying to do this - when I select * rfi_id * in the second combobox, I want it to appear in the text box in my form, where the value * rfi_id * matches the value in the combobox. This is a bit complicated due to the way the tables join ... this is what I'm essentially trying to display in a text field field in terms of SQL:
SELECT Customer.company, RFI.Customer_id FROM Customer, RFI WHERE (((Customer.Customer_id)=[RFI].[Customer_id]) AND ((RFI.rfi_id)=[Forms]![Request for Info Form]![Combo90])) ORDER BY Customer.company;
To do this, I tried the following to no avail. In the event after updating my second combobox, I inserted the following:
companyTB = DLookup("company", "Customer", "Customer_id =" & DLookup("Customer_id", "RFI" And "rfi_id =" & [Forms]![Request for Info Form]![cmbRFI]))
When I change the value of combobox, I get the error Runtime Error '13': Type of mismatch. I tried looking for what I did wrong, but apparently this is a very big mistake, and I can not find anything like it (or what I understand). I also tried this -
companyTB = DLookup("company", "Customer", "Customer_id =" & DLookup("Customer_id", "RFI", "rfi_id =" & cmbRFI))
which gives me the following error: runtime error "3075": syntax error (missing statement) in the query expression. Anyway, would someone be nice to give me a breakdown of what I need to do to achieve this, or what I'm doing wrong (or maybe the best way to do this?). Forgive me for seeming stupid, I just started working with more in-depth access in the last 3 weeks or so. Thanks.