UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Bound Form, Any Version    
 
   
access2009eg
post Feb 14 2020, 01:52 PM
Post#1



Posts: 1,163
Joined: 19-February 08



Hello Freinds

I have a bound form with some text box

I don't want safe the data on the form if some text is null

and I don't want any error message or warning message appears when closing the form

if user click close NO message appear and if the textbox is a null record not save

Thanks in Advance

--------------------
I would like to Thank you for your help
Go to the top of the page
 
DanielPineault
post Feb 14 2020, 02:17 PM
Post#2


UtterAccess VIP
Posts: 7,154
Joined: 30-June 11



Personally, I'd use an unbound form.

But you can try something like:
CODE
Private Sub Form_Unload(Cancel As Integer)
    Dim bNull As Boolean
    
    bNull = Not (IsNull(Me.Control1Name) = False And IsNull(Me.Control2Name) = False)
    If bNull Then
        DoCmd.SetWarnings False
        DoCmd.RunCommand acCmdDeleteRecord
        DoCmd.SetWarnings True
    End If
End Sub

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
access2009eg
post Feb 14 2020, 02:47 PM
Post#3



Posts: 1,163
Joined: 19-February 08



This message appears to me when closing the form using title bar close
This post has been edited by access2009eg: Feb 14 2020, 02:48 PM
Attached File(s)
Attached File  Screenshot_1.png ( 6.6K )Number of downloads: 0
 

--------------------
I would like to Thank you for your help
Go to the top of the page
 
access2009eg
post Feb 14 2020, 02:53 PM
Post#4



Posts: 1,163
Joined: 19-February 08



I solve the problem thumbup.gif

I disable the title bar close button

and add your code to access button

hat_tip.gif


--------------------
I would like to Thank you for your help
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    26th February 2020 - 02:18 PM