Link to home
Start Free TrialLog in
Avatar of Jass Saini
Jass Saini

asked on

When you have a form from a query why wont it allow user input

I have a query from two tables.  I took the query to make a form and the user input repeats for all the queried records
Avatar of Kelvin Sparks
Kelvin Sparks
Flag of New Zealand image

Generally this happens when the form uses fields from the "child" table.

You can try looking at the form properties and set the Recordset Type property to Dynaset (Inconsistent Updates) instead of Dynaset.

Kelvin
Run the query supplying the data. Try editing this query. If it allows the edit, then you need to change your form's setting as Kelvin has described. Otherwise, you have joins other than inner join in your query.
Good thought Mike. I had overlooked that.


Kelvin
As you know, I am your student. You have helped me a lot in the past.

Thanks,

Mike

BTW,  JAss SAini is a new member. Welcome to EE  JAss SAini.
Can you show the SQL of the query? To do that, open the query in the designer, and select the SQL View. Copy and paste that here.

In general, basing a form on a query that includes more than one table can be troublesome, especially if you're dealing with Parent/Child data, as the other Experts have mentioned. If you have a Parent/Child data relationship, you should be using a MainForm/Subform form. This will show the data relationship correctly, and will allow the user to add Child records to a specific Parent, and will also allow the user to add new Parent records, edit existing Parent or Child records, etc.
If you are worried about the repetition, then use a main form for the parent table and a subform for the child table.  Make sure to set the master/child links so Access will keep the two sync'd.

If you can't update the query, you may be joining on the wrong columns so Access can't determine the actual relationship between the two tables.
Avatar of Jass Saini
Jass Saini

ASKER

SELECT DISTINCT Final_Table.ID, dbo_tblOrgLook_master.Analyst, dbo_tblOrgLook_master.Org, dbo_tblOrgLook_master.OrgName, dbo_tblOrgLook_master.CostCenter, dbo_tblOrgLook_master.Fund, dbo_tblOrgLook_master.PEC, dbo_tblOrgLook_master.ProgramName, Final_Table.[Org Name:], Final_Table.Field2, Final_Table.[Fund:], Final_Table.[Line Item:], Final_Table.[Item Number:], Final_Table.[Total Initial:], Final_Table.[Total BC #1 Change to Authority], Final_Table.[Total BC #1 Allotment], Final_Table.[Total BC #2 Change to Authority], Final_Table.[Total BC #2 Allotment], Final_Table.[Total BC #3 Change to Authority], Final_Table.[Total BC #3 Allotment], Final_Table.[Total BC #4 Change to Authority], Final_Table.[Total BC #4 Allotment]
FROM dbo_tblOrgLook_master RIGHT JOIN Final_Table ON (dbo_tblOrgLook_master.CostCenter = Final_Table.Field2) AND (dbo_tblOrgLook_master.PEC = Final_Table.PEC)
WHERE (((dbo_tblOrgLook_master.Analyst) In ('A.Gladden')) AND ((dbo_tblOrgLook_master.Org) In ('5351')) AND ((dbo_tblOrgLook_master.CostCenter) In ('0250000000')) AND ((dbo_tblOrgLook_master.Fund) In ('13G0010000')) AND ((dbo_tblOrgLook_master.PEC) In ('2550000')));


Here is my SQL to the query.  I tried running the query and making changes and it will not allow me to make changes.  help
SOLUTION
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Suggested queries for your consideration:
SELECT 
   o.Analyst
   , o.Org
   , o.OrgName
   , o.CostCenter
   , o.Fund
   , o.PEC
   , or.ProgramName
FROM dbo_tblOrgLook_master o  
WHERE 
o.Analyst In ('A.Gladden') AND 
o.Org In ('5351') AND 
o.CostCenter In ('0250000000') AND 
o.Fund In ('13G0010000') AND 
o.PEC In ('2550000');
==========
SELECT 
   f.ID
   , f.[Org Name:]
   , f.Field2
   , f.[Fund:]
   , f.[Line Item:]
   , f.[Item Number:]
   , f.[Total Initial:]
   , f.[Total BC #1 Change to Authority]
   , f.[Total BC #1 Allotment]
   , f.[Total BC #2 Change to Authority]
   , f.[Total BC #2 Allotment]
   , f.[Total BC #3 Change to Authority]
   , f.[Total BC #3 Allotment]
   , f.[Total BC #4 Change to Authority]
   , f.[Total BC #4 Allotment]
FROM Final_Table f 

Open in new window

Unfortunely I need both tables.  I am still new at this and was given a half bulit DB...The Org table has the Analyst which I need in order to do the search.  My first form is based off that...my query is based off the two tables.  (Can not edit Query for the Blank fields)...My report is based off the query too.  Everything is working except for the last form ..which is based off the query.  I even tried to unbound the fields..put if I place a input into the field it carries to all the records that were queried.
Correct me if I am wrong:

You have Analyst and AnalystActivity (or something similar):

Make frmAnalyst  to use table dbo_tblOrgLook_master for that as recordsource.

on frmAnalyst  add a subform called sfrmAnalystActivity based on the other table.

Link the master/child fields as required.

This way, when you select an analyst in frmAnalyst, the subform displays all activity editable records for that particular analyst. Meaning your where clause will be also simplified.

Mike
You need to get to a point where the query is updateable before the form will be updateable.
What are the primary keys of the two tables and what columns are you joining on?  A one-to-many join (which most are) goes from the PK of the 1-side table to a data field on the many-side table.  The data field on the many-side table is occasionally part of a compound PK on the many-side table.
Post your actual query as you change it.

PS - your column names should be changed before you go much further to conform to standard practice.  They are also on the long side.
[Total BC #2 Change to Authority] could be TotBC2ChngToAuth
Removing the special characters and embedded spaces eliminates the need for the square brackets.  When you use abbreviations, the most important thing is to be consistent.
Mike..dumb question so how do I linl master/Child fields.  I am getting good that this with your help/everybody's help.  This is the only forum where I can actually get answers.  Thank you all...My boss wants me to change the form..so starting from scratch.
Click on the subform control.  Then open the properties dialog and on the data tab, you can enter the master/child links.
As Pat describes, do that. Access generally will suggest master/child links. Master is the field you have on the form which you want to the subform child field.
Everybody on here is so helpful and you get feedback quickly.  They don't belittle you if you don't know, they try to help you.  I love this website.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello Mike...Sorry...but how do you repopen so I can distribute the points.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial