If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

what datatype is Main.ProjectID.. if its string then you need to qualify the [Forms]![Reporting]![Combo28]); with either ' or " so the SQL runtime knows where the value starts and stops

for legibility I'd ditch all the square brakcets, unless you have to use them becuase you have a space in table or column names

Main.[Attachment].[FileData] looks suspicious to me

..as does
[Attachment].[FileFlags]
looks like you are intending to join a table but haven't declared a join

what I'd suggest you do right now is cut and paster your query from the form/report and paste it into the query browser SQL pane and work on it until you get the results you expect. replace the forms!.... expression with a known good value.

its easier to debug SQL if you assign it to a variable then use that variable where ever
text in red is deffo incorrect syntax in Access SQL. that style of qualificartion woudl suggest ta database of main, a table of attachement and a column of whatever
text in blue is also wrong but suggests that there is a table called attachement which isn't declared in a join

your problem is that you have stored the project name in Main.ProjectID. your combo box is using ProjectID as its source but returning the ID.. a numeric value. so there will never be a match between, say 'Ensco Riog 72' (Main.ProjectID) and 1 ProjectID.ID (from combo28)
.
It look like you are using a lookup table rather than a foreign key to the project table
..which isn't that surprising as you have no relationships defiend

The lookup wizard in Access is an abomination that should never ever be used unless you have a totally static range of values. it always causes problems in the end.

I'd strongly recommend that you tidy up your table names and column names before proceeding further (its not necessary but it makes reading your code/tables easier). All tables and columns should describe what they contain. in this case you have a table called ProjectID, which should probably be called Projects.Try to avoid repeating the table name in the column names... why it gets tortuous
select Projects.ProjectName, Projects.ProjectNo from Projects

Sorry im new to ms access. How do I debug SQL in MS acces and how do I add a watch/breakpoint.

If I leave the Forms in the query like this: Main.ProjectID= Reporting!Combo28, then an popup appares and when I type in the text manually, then it will find the record.

I suspect it has something to do with type declaration.. I have no idea how to solve this. I would be very thankfull if someone tested my project and found the solution to how to send the combo selection into the query and make it work...

Sorry im new to ms access. How do I debug SQL in MS acces and how do I add a watch/breakpoint.

see reference in post #8

You need to get to grips with the relational model
see references in post #9

your problem right now is the physical design of the system, get that right and you can then move on user interface design. don't worry about combo boxes or whatever until you have got your table design sorted out.

you should store the ID of the project in table Main.
using the Access lookup wizard is not a smart call. its fine if you know the full range of values at design time (otherwise each time you add a new project then you need to make changes tot he application NOT the data.

you are part way there by having separate tables for Project and so on, but your use of lookup wizard makes those tables redundant

you haven't defined any relationships (a fairly serious omission in a relational database)

the quick fix is to use the text value from the combo box in the query, but its the wrong solution.

Thanks. I found a solution. Its not the best way i guess. The idea about this db was to have 1 table and the other tables just as lookup for comboboxes. hence no relationships needed. Then filter with query and creating report from query. I will read up on database design so I get more understanding on how to build this professionally.