Problem with manipulating records

  • Thread starter AccessVBANewbie via AccessMonster.com
  • Start date
A

AccessVBANewbie via AccessMonster.com

I found out that though an error message, "Microsoft Access has set 1 record
(s) to Null due to type conversion failure" occured, however, if I closed my
form and opened it again, and re-open my table, the new data was inserted.
Why does this happen? And if i deleted a record using SQL statement, why does
all the textboxes contain the words "#Deleted"? The words only disappear when
i re-open the form. Why does this happen?
 
T

TC

If you delete the current record of a form, "behind the scenes",
through VBA code, Access quite properly indicates that fact, by
displaying #Deleted in all of the fields of the record. This is Access
saying: "Sorry, I can't show you the values from this record any more,
because someone [in this case, you] has deleted it behind the scenes!"

You should not normally delete the current record in that way. Why are
you actually doing that? Maybe we can suggest a better way to achieve
what you want.

HTH,
TC
 
A

AccessVBANewbie via AccessMonster.com

hmm TC... then how should I delete a record in my database? My aim is to have
users using the database, to be able to insert, delete and update records
found in the tables through the form-mode, so when they click on the delete
button which i created in the form, they would be directed to a new form,
where they enter the ID number of the record they wish to delete, and then
pressing the confirm delete button, which will delete the record accordingly.
If I can't delete it through the VBA code-behind codings, is there any other
way I could allow users to delete records in my table through the form-mode?
Because this database is used by operators and engineers, they would not know
any VBAs or codings, so I had to make it simple for them to delete, insert
and add records through the interface... any idea how I could go about doing
this TC?
If you delete the current record of a form, "behind the scenes",
through VBA code, Access quite properly indicates that fact, by
displaying #Deleted in all of the fields of the record. This is Access
saying: "Sorry, I can't show you the values from this record any more,
because someone [in this case, you] has deleted it behind the scenes!"

You should not normally delete the current record in that way. Why are
you actually doing that? Maybe we can suggest a better way to achieve
what you want.

HTH,
TC
 
T

TC

A standard Access form will /automatically/ let you find, add, edit and
delete records in/to/from the table! You don't need any code for that,
at all. Just put the name of the table into the RecordSource property
of the form, and put the name of the relevant field into the
ControlSource property of each control on the form.

If you /do/ write your own code, you have to have a detailed
understanding of how your code will co-exist with Access'es built-in
find/add/edit/delete functionality. So that would be a fairly advanced
technique. If you don't understand it in detail, you will get all sorts
of strange probloems, including but not limited to, the one that you
described in your original post.

So I suggest that you build a new form, setting the RecordSource and
ControlSource properties as I described abive, then try using Access'es
built-in ability to find, add, edit & delete records without any
programming.

HTH,
TC
 

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