subform datasheet will not add new record

  • Thread starter Thread starter TJones
  • Start date Start date
T

TJones

I have a "OrderForm" which contains "Item Buttons" where
a user can choose to add items to a subform
called "OrderDetails". "OrderDetails" is set to display
in Datasheet view. When you click on an "Item Button" it
should then (using a macro) 'set the value' of several of
the fields in the subform "OrderDetails". You should, in
theory, be able to add as many items as you would like
onto the "OrderDetails" subform, however, I can't get it
to add past one. In other words, if I click on an "item
button" it will update the subform just as it should....
however, if I click on another item button, it will just
set the value of that same record in the subform instead
of adding another record.

Anyone have any ideas?? I'm desperate!

Thanks
TJones
 
This can happen if you're using a query as the data
source for the forms. I would suggest to use the tables
themselves as the data source for each form. You might
also want to check to see if you are allowing the form to
add records in the "Allow Additions" property in design
view for the form.
 
Thanks Bob, but I am using the tables themselves as the
data source and the "allow additions" property is set to
allow additions. I just can't figure out why it is doing
this.

Thanks
Tammie
 
TJones,

If you are using SetValue actions in your macro, these will apply to the
current record in the subform. You could put a GoToRecord/New action in
the appropriate place in the macro. However, I would not recommend
this. I think you would be better advised to set up an Append Query to
insert the new items into the subform's underlying table, and if you
like you can use an OpenQuery action on your macro to make this happen.
 
Perhaps it's not saving the record so it can't add another. I had a
similar issue where most of the fields had default values. The record
'looked' complete, but only because the default values were filling
in. In truth, the record was still New.

My solution, dirty as it may be, and I've love to see a nicer
solution, was to have a text box, txtjunk, sized zero by zero so it's
essentially invisible. Upon clicking any of the 'item detail'
buttons, it first looks to see if the record is new. If so, it sets
my txjunk field to "junk", finally giving the record some "real" data
to chomp on, and then I could save the record.

HTH,
Tracy
 
Perhaps it's not saving the record so it can't add another. I had a
similar issue where most of the fields had default values. The record
'looked' complete, but only because the default values were filling
in. In truth, the record was still New.

My solution, dirty as it may be, and I've love to see a nicer
solution, was to have a text box, txtjunk, sized zero by zero so it's
essentially invisible. Upon clicking any of the 'item detail'
buttons, it first looks to see if the record is new. If so, it sets
my txjunk field to "junk", finally giving the record some "real" data
to chomp on, and then I could save the record.

HTH,
Tracy
 
Back
Top