Avatar of bobby6055
bobby6055

asked on 

Deleting current record

I have tried several onclick delete code. Now I want to try something new using some conditions as follows.

Perform delete action in the Edit or newRecord mode with the following defined conditions.

(a). If "IsNull or nothing" in text1(currentscreen), or text2(currentscreen)  or text3(currentscreen),
         then msgbox "Nothing to delete.

       Else....

(b). If "Not Is Null" text1(currentscreen), or text2(currentscreen)  or text3(currentscreen),
       Then msgbox "Are you sure you want to delete the current record #111 (for example)

      If User Response is "Yes" then perform the delete action for record id #111
      If User Response is "No" then do not perform the delete action for record id #111

 
Microsoft ApplicationsMicrosoft Access

Avatar of undefined
Last Comment
Lambert Heenan
Avatar of als315
als315
Flag of Russian Federation image

Check this sample
DB27038488.mdb
ASKER CERTIFIED SOLUTION
Avatar of Lambert Heenan
Lambert Heenan
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of bobby6055
bobby6055

ASKER

LambertHeenan:
I tried your suggestion from an Onclick command button. When I clicked the button to delete, I recieved
a Microsoft Visual Basic dialog box with a Run-Time error  '3167': "Record Deleted"

How do I resolve the error?

Bobby
Avatar of bobby6055
bobby6055

ASKER

Debug highlighted ..... Me. Requery

so I changed it to .,..... Me.Refresh
....and the error disappeared.
Sorry 'bout that. I often mix up refresh and requery. :-)
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo