Inserting a record in a continuous form

  • Thread starter Thread starter Paul Joselow
  • Start date Start date
P

Paul Joselow

How do you insert a new record between other records in a
continuous form? I see how to delete a record and I can
easily append a record after all the existing records but
this function eludes me.
I can left click on the record indicator buttons on the
left side of the form and the arrow button moves to where
I left clicked. I can right click but unline the
datasheet view, there's no option to insert a record.
 
Paul Joselow said:
How do you insert a new record between other records in a
continuous form? I see how to delete a record and I can
easily append a record after all the existing records but
this function eludes me.

That's because you can't do it. New records go at the end of the form, period. This
doesn't necessarily mean they go at the end of the table as tables are by definition
unordered. If your form has a sort order, then requerying the form will place the
new row where it belongs in the sort order. Where it is "inserted" matters not at
all.
 
Paul Joselow said:
So is there a way of reading the position of the cursor on
a continuous form in Visual Basic (i.e. find out what
record the cursor is pointed to)? If I can do that, I can
create a button to do what I want.

If the records in the form are displayed in a particular order it is because a sort
has been applied to either the form or its RecordSet. That sort order is using a
field or fields in the RecordSet to perform the sort. You can always read the values
of these fields for the current record and then create a record with a value that
will place the new record "below" the current one in the sort order. You will still
have to type that new record at the bottom of the form, but when the form is
requeried, it will appear "under" the record you were positioned at. To make it
appear "directly under" the current record you would have to know the values of the
sorting fields for the record that was previously in that position or have a system
that lets the user decide what sort values to insert.

For example. I have a manufacturing document database where these requirements come
into play. As rows are inserted, they are numbered as 100, 200, 300 etc.. If a user
needs to position new rows between rows 100 and 200 they simply add the rows and
assign them the numbers 110, 120, etc., and when the form is requeried they end up in
the desired position. We use multiples of 10 for the insertions to allow for future
rows to be inserted between the new ones. If we run out of positions then a utility
is provided to renumber all rows as multiples of 100 again (this rarely occurs).

In my case I used a shortcut menu so the user can Right-click on the record where
they want the new rows inserted "under" and from the menu choose "Insert Row". I
then create a new record at the bottom of the form pre-numbered based on what row
they were on when they called the function. This is a default, but can be changed by
the user if they want.
 
-----Original Message-----


If the records in the form are displayed in a particular order it is because a sort
has been applied to either the form or its RecordSet. That sort order is using a
field or fields in the RecordSet to perform the sort. You can always read the values
of these fields for the current record and then create a record with a value that
will place the new record "below" the current one in the sort order. You will still
have to type that new record at the bottom of the form, but when the form is
requeried, it will appear "under" the record you were positioned at. To make it
appear "directly under" the current record you would have to know the values of the
sorting fields for the record that was previously in that position or have a system
that lets the user decide what sort values to insert.

For example. I have a manufacturing document database where these requirements come
into play. As rows are inserted, they are numbered as 100, 200, 300 etc.. If a user
needs to position new rows between rows 100 and 200 they simply add the rows and
assign them the numbers 110, 120, etc., and when the
form is requeried they end up in
the desired position. We use multiples of 10 for the insertions to allow for future
rows to be inserted between the new ones. If we run out of positions then a utility
is provided to renumber all rows as multiples of 100 again (this rarely occurs).

In my case I used a shortcut menu so the user can Right- click on the record where
they want the new rows inserted "under" and from the menu choose "Insert Row". I
then create a new record at the bottom of the form pre- numbered based on what row
they were on when they called the function. This is a default, but can be changed by
the user if they want.
Could you give me some class/method/event name/etc.
keywords that I can look up for this please.
 
Back
Top