can't add new record to sub-form (continuous)

P

p-rat

I have a form where we enter data. On this main form there is a sub-
form. It is continuous form. I can add as many items as I need and it
works great.

I can then go through an EDIT button on my switchboard and it'll ask
for example the Ticket Number. I type in the ticket number and it'll
pull up the form with all the data that was entered during the data
entry process. I can change things throughout; even in the sub-form,
but I can't ADD a record in the sub-form.

In data entry process you can TAB through the continuous sub-form and
it'll create as many records as needed. When tabbing through in the
EDIT phase it won't create any new records.

How do I solve this? I need to be able to add another record. Thanks.
 
M

Marshall Barton

p-rat said:
I have a form where we enter data. On this main form there is a sub-
form. It is continuous form. I can add as many items as I need and it
works great.

I can then go through an EDIT button on my switchboard and it'll ask
for example the Ticket Number. I type in the ticket number and it'll
pull up the form with all the data that was entered during the data
entry process. I can change things throughout; even in the sub-form,
but I can't ADD a record in the sub-form.

In data entry process you can TAB through the continuous sub-form and
it'll create as many records as needed. When tabbing through in the
EDIT phase it won't create any new records.

How do I solve this? I need to be able to add another record. Thanks.


.... and check the switchboard EDIT button's Click event
procedure. Look at the OpenForm line and make sure the
Datamode argument is acFormEdit (or not specified if the
form's properties have bot AllowEdits and AllowAdditions set
to Yes).
 
P

p-rat

i've checked AllowEdits and AllowAdditions and they are both set to
yes. i also checked the EDIT button and don't see any code as Marshall
mentioned. when run a query i can't add either. is this normal?

p-rat said:
I have a form where we enter data. On this main form there is a sub-
form. It is continuous form. I can add as many items as I need and it
works great.
I can then go through an EDIT button on my switchboard and it'll ask
for example the Ticket Number. I type in the ticket number and it'll
pull up the form with all the data that was entered during the data
entry process. I can change things throughout; even in the sub-form,
but I can't ADD a record in the sub-form.
In data entry process you can TAB through the continuous sub-form and
it'll create as many records as needed. When tabbing through in the
EDIT phase it won't create any new records.
How do I solve this? I need to be able to add another record. Thanks.

... and check the switchboard EDIT button's Click event
procedure.  Look at the OpenForm line and make sure the
Datamode argument is acFormEdit (or not specified if the
form's properties have bot AllowEdits and AllowAdditions set
to Yes).

--
Marsh
MVP [MS Access]- Hide quoted text -

- Show quoted text -
 
J

John W. Vinson

when run a query i can't add either. is this normal?

Normal... for a non-updateable query, which would also cause the other
symptom!

There are many reasons why a query might not be updateable. A multitable query
will only be updateable if the joins are from fields with a unique index (such
as a primary key) to an indexed field; if there are too many tables even that
might not help. No Totals query, nor any query containing a Totals query, is
ever updateable; a UNIQUE VALUES query (starting with SELECT DISTINCT... in
SQL view) isn't; a UNION query isn't; other reasons. Perhaps you could open
the query in SQL view and post it here.
 
P

p-rat

Sorry I'm not more versed in Access, but I can ADD directly to table
and ADD during data entry. Here is the SQL for the query used on
subform during EDIT:

SELECT

dbo_PayrollDetail.DailyWorkTicketNumber,
IIf(dbo_PayrollDetail.Date Is
Null,dbo_MercerDailyWorkTicketHdr.Date,dbo_PayrollDetail.Date) AS
Date1,
dbo_PayrollDetail.EmployeeNumber, dbo_PayrollDetail.EmployeeName,
dbo_PayrollDetail.JobTitle, dbo_PayrollDetail.TravelTime,
dbo_PayrollDetail.WorkTimeOnJob, dbo_PayrollDetail.CoTime,
dbo_PayrollDetail.CostCenter, dbo_PayrollDetail.Hours,
dbo_PayrollDetail.PayCategory, dbo_PayrollDetail.Misc_Text_Field_1,
dbo_PayrollDetail.Misc_Text_Field_2,
dbo_PayrollDetail.Misc_Text_Field_3

FROM dbo_PayrollDetail INNER JOIN dbo_MercerDailyWorkTicketHdr ON
dbo_PayrollDetail.DailyWorkTicketNumber =
dbo_MercerDailyWorkTicketHdr.DailyWorkTicketNumber;


thanks for any help.
 
J

John W. Vinson

Sorry I'm not more versed in Access, but I can ADD directly to table
and ADD during data entry. Here is the SQL for the query used on
subform during EDIT:

SELECT

dbo_PayrollDetail.DailyWorkTicketNumber,
IIf(dbo_PayrollDetail.Date Is
Null,dbo_MercerDailyWorkTicketHdr.Date,dbo_PayrollDetail.Date) AS
Date1,
dbo_PayrollDetail.EmployeeNumber, dbo_PayrollDetail.EmployeeName,
dbo_PayrollDetail.JobTitle, dbo_PayrollDetail.TravelTime,
dbo_PayrollDetail.WorkTimeOnJob, dbo_PayrollDetail.CoTime,
dbo_PayrollDetail.CostCenter, dbo_PayrollDetail.Hours,
dbo_PayrollDetail.PayCategory, dbo_PayrollDetail.Misc_Text_Field_1,
dbo_PayrollDetail.Misc_Text_Field_2,
dbo_PayrollDetail.Misc_Text_Field_3

FROM dbo_PayrollDetail INNER JOIN dbo_MercerDailyWorkTicketHdr ON
dbo_PayrollDetail.DailyWorkTicketNumber =
dbo_MercerDailyWorkTicketHdr.DailyWorkTicketNumber;


thanks for any help.

First off... why are you joining the payrolldetail table to the work ticket
hdr table for this form? Typically - not universally, but typically - one
would use a Form for the "one" side table and a Subform for the "many". I'm
not clear which is which in this case.

Secondly, obviously the Date1 field will not be updateable since it's
calculated. Other than that, is DailyWorkTicketNumber the Primary Key of
MercerDailyWorkTicketHdr? It should be in order for the query to be
updateable. You may also need to include tat field from both tables in the
query's SELECT clause.
 
P

p-rat

Subform is for the 'many'. On the main form it is for header
information such as customer, location, etc. The sub-form are the
employees who worked on that ticket (could be 1 employee or many
employees on that 1 ticket).

Problem is that not all employees have hours on a work ticket. So I
have two data entries for payroll hours. One being the DailyWorkTicket
form and another just a form that only captures payroll
information ....not all or any ticket information. This payroll
information from both places is in one table. I believe why they did
things this way was that if the hours were on a DailyWorkTicket then
the date came from this table, but if the hours came from the payroll
form then the date came from this table. Kind of screwy. Hope this
might clear some of that up.
 
J

John W. Vinson

Subform is for the 'many'. On the main form it is for header
information such as customer, location, etc. The sub-form are the
employees who worked on that ticket (could be 1 employee or many
employees on that 1 ticket).

Problem is that not all employees have hours on a work ticket. So I
have two data entries for payroll hours. One being the DailyWorkTicket
form and another just a form that only captures payroll
information ....not all or any ticket information. This payroll
information from both places is in one table. I believe why they did
things this way was that if the hours were on a DailyWorkTicket then
the date came from this table, but if the hours came from the payroll
form then the date came from this table. Kind of screwy. Hope this
might clear some of that up.

Wow, no; it makes it considerably more confusing!

I'm not sure what a "work ticket" is; nor why it's still necessary to base the
subform on a joined query. It SOUNDS like the subform could be based just on
the PayrollDetail table, using the DailyOrkTicketNumber as the master/child
link field. If not, try opening the query as a query datasheet. Is *IT*
updateable? If it's not, is DailyWorkTicketNumber the primary key of
MercerDailyWorkTicketHdr, or does it have a unique Index?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top