Darren DICK
d.dick at uws.edu.au
Tue Apr 13 17:42:54 CDT 2004
Thanks Gustav et al I will use this method in the future many thanks Darren ----- Original Message ----- From: "Gustav Brock" <gustav at cactus.dk> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Tuesday, April 13, 2004 12:04 AM Subject: Re: [AccessD] A2K: Stop User from oving to new record > Hi Darren > > > Hi Bryan > > I did that no joy eg. > > That is because your expression will never be True as > > Me.cmbOffence = "" > > will be Null if Me.cmbOffence is Null, and then > > IsNull(Me.cmbOffence) Or Null > > will return Null as well. > > The fastest method is: > > If Len(Me.cmbOffence & vbNullString) = 0 > > but mostly I prefer to use Nz(): > > If Len(Nz(Me.cmbOffence, vbNullString)) = 0 > > As Stuart mentions, you may omit the last part, but you must be sure > that the value tested is either Null or a string (which is the case > here as I guess cmbOffence is a combobox): > > If Len(Nz(Me.cmbOffence.Value)) = 0 > > /gustav > > > > Private Sub Form_BeforeUpdate(Cancel As Integer) > > > If IsNull(Me.cmbOffence) Or Me.cmbOffence = "" Then > > MsgBox "Enter an offence" > > Cancel = True > > End If > > > End Sub > > > What I need to do is somehow test if the user is on a new fresh record or has left th previous record with unfilled combos. Of > > course I can do it on the lost and got focus event.Thats fine whilst I am in the record > > EG record 5 has no offence recorded > > User goes to record 6 How do i alert the user that record 5 has a missing value then go back to that record? > > > > ----- Original Message ----- > > From: "Bryan Carbonnell" <carbonnb at sympatico.ca> > > To: "Access Developers discussion and problemsolving" <accessd at databaseadvisors.com> > > Sent: Monday, April 05, 2004 10:25 AM > > Subject: Re: [AccessD] A2K: Stop User from oving to new record > > > >> On 5 Apr 2004 at 10:08, Darren DICK wrote: > >> > >> > I have a simple subform with 4 fields on it > >> > ID (PK), txtDateOfOccurence, cboClientName, cboOffence > >> > > >> > How can I tell if the user goes to a new record and they have not > >> > completed ALL fields in the previous record How do I alert them and > >> > then direct them back to the previous record? > >> > >> Use the before update event of the form. Check to make sure they > >> entered a vale and if not set Cancel = true in the event. That should > >> prevent the record from being saved and keep the sub form on the > >> "unfinished" record > > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com