Cant edit records in a query...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all....

I have a DB with six tables that have an identical structure, except each
corresponds to a different set of people. I then use a Union Query to put
them all together, and then use a select query on the Union Query, to select
a certain number of fields that I will need. I then use a form, with the
select query as the recordsource, however, I am unable to edit the data
presented to me in the form.... How do I fix this? I need to be able to edit
the records in my form view...

Any help would be great.. thanks.

Alex B.
 
Alex, I would suggest putting all your data in a single table and add a
column that indicates which group a particular record belongs to. This should
simplify your form query to selecting the fields desired and make it editable.

HTH,
Sam
 
Fair enough... I would still need one query however, since I am using a VB to
search for strings in a field. The code cocntinually changes the
recordsource of a form by means of an sql statement, so that I can filter
info. I will further explain:

Basically my tables have these fields... IDKEY, ID, LastName,
SecondLastName, Names, assisted.

IDKEY is the primary key and it is autonumeric
ID is text and corresponds to an ID Code for each person.
LastName, SecondLastName and Names are text
Assisted is a yes no field

I have done as you sugested and added the following fields:
Section and Area
Section in a letter, either A, B or C
Area is a name: either Alpa or Beta
So a sample record would say:
1 1-A Doe Smith John A Alpha
(yes/no) box

From here, I make a form, call it subForm, and have the recordsource set to
SELECT ID, Names & " " & LastName & " " & SecondLastName as COMPL_NAME,
Section, Area, Assisted
FROM table;

set this form to continous

I then have another form, called main form, which uses the previous form as
a subform. The main form is unbound. I have an unbound textbox with an
event trigger on KeyPress. I then have it change the recordsource for the
subform, by adding a where clause to the end of the sql statement, and using
like with the data from the unbound textbox. This will eliminate entries and
acts like a search function. Now, the only thing I really want to be able to
edit is the assisted checkbox. However, by setting a recordsource to
something that is in effect a query, I am unable to edit the subform...

I hope this clears some stuff up about my problem... any other questions
ask, and thanks for answering....
 
Alex,

Sam's advice was spot-on. It looks like you have done what he
suggested, which means, as I understand it, that the record source of
the subform will now be a select query and not a union query. A union
query is not updateable, and I assume this was the cause of the problem
before. On the basis of the examples you have given, I see no reason
now why the subform data should not be editable. Is the AllowEdits
property of the subform set to Yes?
 
Got it... Just a little problem with the structure, but yep, putting them
altogether fixed it. In fact, I realized that my DB was backwards... :D, I
should have originally made it like this and then when I needed each section,
just make a select query for each partifcular section... Thanks All...

Alex
 
Back
Top