Psudo-Delete command button

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

Guest

Hi guys

I'm having trouble figuring this one out as I'm still VBA-dumb. I've seen this idea here before but can't relocate it so I'm asking for your assistance

My form has a command button labeled "Delete". When the user clicks the button, I would like to have the record no longer visible in various forms, listboxes, etc. I have added to the table a yes/no field. I'll set up my queries to not include any records that have the field value 'yes' (or is it more technically '-1')

I'm stuck on the 'On Click' event code, I can't figure out how to tell VBA "Update the current record field to 'yes' and then refresh/requery the form recordsource.

Either pointing me to a generic sample or posting a sample would be appreciated

TIA

Rick...
 
New version of the original question. (Sorry if you've posted a reply already..

After I posted the original question, I got to thinking about the word 'Update', searched for that and have now created a start

Here's my current code (it doesn't quite work - it will 'delete' the first record in the table, not the currently displayed record)

Private Sub cmdDelete_Click(
Dim rs As DAO.Recordse
Set rs = Me.RecordsetClon

rs.Edi
rs!DeletedByUser = -
rs.Updat
lboSchedule.Requer
DoCmd.RepaintObject acForm, "frmSchedule

End Su

So my new question is: How do I change the code so that I get the current record updated

TIA

Rick...
 
Adding a logical field to your table is step 1. Step two is to requery the
control where the field is displayed.
 
Hi guys

Thanks for all of your previous help on this newsgroup - I guess I'm learning 'cause I've figuered out something that works based upon other help you all have provided to me. To bad the brain doesn't kick in until after I've posted sum dum question....

I'll post the code just in case someone wants to evaluate/offer better solution

Private Sub cmdDelete_Click(
Dim rs As DAO.Recordse
Set rs = Me.RecordsetClon

rs.FindFirst "[SchedID] = " & Str(Nz(Me![SchedID], 0)
If rs.NoMatch The
Exit Su
End I
If Not rs.EOF Then Me.Bookmark = rs.Bookmar
rs.Edi
rs!DeletedByUser = -
rs.Updat
rs.Clos
Set rs = Nothin
lboSchedule.Requer
DoCmd.RepaintObject acForm, "frmSchedule

End Su

Thanks again to all

Rick...
 
Hi Rolls

Thanks for the pointers and taking the time to post.

I've got something that works now, but I guess my third post got there after you posted, else you might have done something different.

I have added code that repaints the form - I guess it gets the same result as requerying the control? And I have the controls visible set to 'no' anyway so...

Rick..
 
Back
Top