adding new records trough form

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

Guest

Hello,
I have a form trough which i record order details for my firm. This form is a continuos form with just 3 textboxes (description, price, quantity). The cycle property is settled to "current record". Once i have provided the values for the textboxes i click on a command button to ad a new record. I would like to have the first record always visible, instead it desappear and i have to go up with the scroll bar to make it visible again. The dataentry property should be settled to "yes" because i want to have visible only records form tblorder_details for the order i'm working on. What i don't like is that when you enter on the first textbox, immediatly a new blank record is showed under the first one: i would like it happens only when i click on the button.
Thanks,
Rocco
 
Rocco,

Set the Allow Additions property of the form to No.
As part of the procedure on your command button, include...
Me.AllowAdditions = True
.... and then on the form's BeforeInsert event...
Me.AllowAdditions = False

- Steve Schapel, Microsoft Access MVP
 
Thanks Steve,
i have already builded some code like yours but it hasn't solved my problem.
Let's me better explain what i would like.
Referring to your code, once i clicked on the button, i have a new blank record, nice! But.. where is the one i have previously saved? It is visible only if i scroll up. But as soon as i click on the button i can see only 3 blank textboxes ready to be edit for a new record. I need all the record i'm inserting will stay always visible on the screen (like a list, at list all records that can fit the screen, obviously). Those records are the details for orders to suppliers. I have tried working on dataentry property but it affects all records on detail table making, all records visible while i want visible only those records that refer to the ordder i'm working on. Hope to have better explained (i'm italian...that's not excuse me from my bad knowledge of english but that's it!).
Rocco
 
Let me try to clarify what you want.

First, you want only the records related to a given order to display,
correct? The best way to do this is to either base your form on a query
that has your order ID as a criteria, or use the Filter property to filter
the records on the form. (The first is more efficient, the latter is easier
to modify in code.)

Second, are you trying to copy certain details from a previous record to
your new record? I'm trying understand why you want to view the new record
and the old record at the same time. If you do want to copy the
information, the best way to do this is by assigning the values of the
record to be copied in your "new record" code. Then, have the code create
the new record. Then, paste the information from the variables back into
the proper fields on the new record.

HTH,

Marshall Smith
Project Developers, Inc.


rocco said:
Thanks Steve,
i have already builded some code like yours but it hasn't solved my problem.
Let's me better explain what i would like.
Referring to your code, once i clicked on the button, i have a new blank
record, nice! But.. where is the one i have previously saved? It is visible
only if i scroll up. But as soon as i click on the button i can see only 3
blank textboxes ready to be edit for a new record. I need all the record i'm
inserting will stay always visible on the screen (like a list, at list all
records that can fit the screen, obviously). Those records are the details
for orders to suppliers. I have tried working on dataentry property but it
affects all records on detail table making, all records visible while i want
visible only those records that refer to the ordder i'm working on. Hope to
have better explained (i'm italian...that's not excuse me from my bad
knowledge of english but that's it!).
 
Back
Top