delete record with vb code

G

Guest

Using Access 2007;
I have a form where the user can reset an option group or field to blank
(Me!FrameX=Null). However, when I look in the table it has created a blank
record. This causes a problem when I print the report because the subreport
header shows up even though the detail portion with the field data is empty.
I think my only solution is to add code to my reset to blank button. (If I
use the button wizard and create a delete record button and put it on my form
this works. That is, I hit the reset to blank button, and then I hit the
delete record button and it achieves the desired result). The delete record
button created with the button wizard works off of an embedded macro-- I do
not know what its VB code is.
What VB code do I add to my reset to blank button to get it to also delete
the record with the the on click event?
Thanks
 
A

Allen Browne

If setting the value of FrameX creates a record, we can assume FrameX is
bound to a field in your table.

If it is bound, then you would clear the form not by modifying the existing
record, but by moving to a new record:
RunCommand acCmdRecordsGotoNew
 

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