Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access report from form

Status
Not open for further replies.

Brent113

Programmer
Aug 13, 2003
67
US
I need a report where the data is one record from two separate forms. The forms input into two tables, and I have constructed a query to pull them together (they have a relantionship already). I need just one record, and thought that I could make the query show the record if the its data matches that in the open form whose record I want. When run, the query comes up with no results, even though one record from the tables have to match the one from the form. Here is the SQL:

SELECT tblContact.FName, tblContact.LName, tblContact.Organization, tblContact.Address, tblContact.City, tblContact.State, tblContact.Zip, tblContact.DayPhone, tblContact.EvePhone, tblContact.Fax, tblContact.Email, tblContact.Website, tblNeeds.PanelSetA, tblNeeds.PanelSetB, tblNeeds.CaseA, tblNeeds.CaseB, tblNeeds.CaseC, tblNeeds.Location, tblNeeds.MoveIn, tblNeeds.MoveOut
FROM tblContact INNER JOIN tblNeeds ON tblContact.ID = tblNeeds.ID
WHERE (((tblNeeds.PanelSetA)=[Forms]![frmNeeds]![PanelSetA]) AND ((tblNeeds.PanelSetB)=[Forms]![frmNeeds]![PanelSetB]) AND ((tblNeeds.CaseA)=[Forms]![frmNeeds]![CaseA]) AND ((tblNeeds.CaseB)=[Forms]![frmNeeds]![CaseB]) AND ((tblNeeds.CaseC)=[Forms]![frmNeeds]![CaseC]) AND ((tblNeeds.Location)=[Forms]![frmNeeds]![Location]) AND ((tblNeeds.MoveIn)=[Forms]![frmNeeds]![MoveIn]) AND ((tblNeeds.MoveOut)=[Forms]![frmNeeds]![MoveOut]));


Any help is welcome to get the query return the record the form currently is showing. If anything else is needed just ask.


Thanks in advance,

Brent Scrivner
 
Are the data types STRINGS OR NUMBERS?
See if one record shows from one table first.
also remove all the fields in the query except one and see if you get results.
I suspect you have a problem with so many "AND"'s
try adding one back at a time.

also see if you get a result by harcodeing in the info

liks so

.... WHERE (((tblNeeds.PanelSetA)='xyz') AND ((tblNeeds.PanelSetB)='1234') ....

Hope this helps

DougP, MCP
 
Some types are strings, some are dates, a nd some are check boxes. Could this be the problem?

Thanks in advance,

Brent Scrivner
 
I thought of a better solution over time. I added an autonumber field to the table the form saved to. Then I had that field as an invisible control. In the query, I told it to find the record that contained that unique record ID. It works awesome and took about 20 seconds to do, versus the two to three weeks I had been working on the other method. Programming's that way though. . . :)

Thanks for the help though DougP

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top