How can i Disappear a Blank Record ?

K

Kimon

hi,

I want ask you for a problem I am dealing with is the following one:
In a continuous form, when the user clicks on the “add new record†button,
the form adds a new blank record.
When the user moves the cursor in another record of the list, without filling
the previously mentioned “new recordâ€, this “new record†remains in the list.

How can I make the “new record†- which remains blank – disappear from the
list?

Another question also:

Can I use the command “bookmark†and how?

I would appreciate a prompt reply. Thank you in advance for your attention.
 
A

Allen Browne

A form has the "new record" at the end. However, merely visiting this blank
new row does not add it to your table.

If it is being added to your table, you must have something which is
assigning a value to a bound control. For example, you might have some code
in the Current event of the form, or in the Click event of your command
button.

By removing the code that assigns the value to the control, you will find
that Access doesn't add any record to the table when you move to the new
record.
 
B

Baz

In a form which allows inserts, the "blank" record is always there awaiting
the entry of a new record. All that happens when you click the "new record"
button is that Access takes you to the "blank" record which was already
there. The only way to get rid of it would be to hide the Access navigation
buttons and program your own buttons (and the form's Current event) to
manipulate the "AllowAdditions" property of the form. I very much doubt
that it's worth it.

What exactly do you want to do with bookmarks?
 
K

Kimon via AccessMonster.com

Thanks for your help.

I found the solution for this problem.

Dim NewAdd as Boolean <- I put it in the top of the form code

then in the Current event i wrote..

If Me.NewRecord = True Then
NewAdd = True
Else
If NewAdd = True Then
NewAdd = False
If Me.Recordset.RecordCount() <> 0 Then
If Me.AllowAdditions = True Then
Me.AllowAdditions = False
End If
End If
End If
End If

Allen said:
A form has the "new record" at the end. However, merely visiting this blank
new row does not add it to your table.

If it is being added to your table, you must have something which is
assigning a value to a bound control. For example, you might have some code
in the Current event of the form, or in the Click event of your command
button.

By removing the code that assigns the value to the control, you will find
that Access doesn't add any record to the table when you move to the new
record.
[quoted text clipped - 15 lines]
I would appreciate a prompt reply. Thank you in advance for your
attention.
 
K

Kimon via AccessMonster.com

I want to know how can i use the command bookmark to get to position of a
record in the file and if the user moves the focus in an other record to get
also the new bookmark and compare them.

Thanks for your help
In a form which allows inserts, the "blank" record is always there awaiting
the entry of a new record. All that happens when you click the "new record"
button is that Access takes you to the "blank" record which was already
there. The only way to get rid of it would be to hide the Access navigation
buttons and program your own buttons (and the form's Current event) to
manipulate the "AllowAdditions" property of the form. I very much doubt
that it's worth it.

What exactly do you want to do with bookmarks?
[quoted text clipped - 3 lines]
When the user moves the cursor in another record of the list, without filling
the previously mentioned "new record", this "new record" remains in the list.

How can I make the "new record" - which remains blank - disappear from the
list?
[quoted text clipped - 4 lines]
I would appreciate a prompt reply. Thank you in advance for your attention.
 
B

Baz

A bookmark uniquely identifies a position in a recordset, but it doesn't
tell you the record's ordinal position or help you with the relative
positions of records. It's hard to know what to advise without knowing why
you want to compare the positions of records, but it may be that what you
really want is the AbsolutePosition property of the form's recordset. If
you can explain further about what you want to achieve (in functional terms)
it may be possible to give more detailed advice.

Kimon via AccessMonster.com said:
I want to know how can i use the command bookmark to get to position of a
record in the file and if the user moves the focus in an other record to get
also the new bookmark and compare them.

Thanks for your help
In a form which allows inserts, the "blank" record is always there awaiting
the entry of a new record. All that happens when you click the "new record"
button is that Access takes you to the "blank" record which was already
there. The only way to get rid of it would be to hide the Access navigation
buttons and program your own buttons (and the form's Current event) to
manipulate the "AllowAdditions" property of the form. I very much doubt
that it's worth it.

What exactly do you want to do with bookmarks?
[quoted text clipped - 3 lines]
When the user moves the cursor in another record of the list, without filling
the previously mentioned "new record", this "new record" remains in the list.

How can I make the "new record" - which remains blank - disappear from the
list?
[quoted text clipped - 4 lines]
I would appreciate a prompt reply. Thank you in advance for your
attention.
 
K

Kimon via AccessMonster.com

The reason is that when the user adds a new record without to filling any off
the fields and then moves the focus in an other record, i want to know the
position of the new empty record (because i want to check it for empty
fields and if there are, i want this record to dissaper and then to move the
focus to the other old record which had focused before).
A bookmark uniquely identifies a position in a recordset, but it doesn't
tell you the record's ordinal position or help you with the relative
positions of records. It's hard to know what to advise without knowing why
you want to compare the positions of records, but it may be that what you
really want is the AbsolutePosition property of the form's recordset. If
you can explain further about what you want to achieve (in functional terms)
it may be possible to give more detailed advice.
I want to know how can i use the command bookmark to get to position of a
record in the file and if the user moves the focus in an other record to get
[quoted text clipped - 24 lines]
 
B

Baz

Kimon via AccessMonster.com said:
The reason is that when the user adds a new record without to filling any off
the fields and then moves the focus in an other record, i want to know the
position of the new empty record (because i want to check it for empty
fields and if there are, i want this record to dissaper and then to move the
focus to the other old record which had focused before).

Sorry, I'm struggling to understand that.

If you don't want the user to be able to enter a new record at all, then set
the form's AllowAdditions property to No.

If you don't want the user to be able to enter a new record without first
completing the record he/she is in, then you need to validate the data,
typically by programming the form's BeforeUpdate event.
 

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