Home > Archive > MS Access database support > February 2006 > How to add restriction that field is empty.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to add restriction that field is empty.
AA Arens

2006-02-18, 8:24 pm

I have button and added the command that places a date and some stripes
in the Notes-field. That works fine. If there is already some text, it
places the date at a next line:

Private Sub Command80_Click()
Me.Notes = Me.Notes & vbCrLf & Format(Date, "dd-mm-yyyy") & " ------ "
Notes.SetFocus
Notes.SelStart = Len(Notes.Value)
End Sub

However, when the Notes field is empty it still places the date at the
next line, leaving the first line empty. How to have the date placed in
the upper-left corner (the start of the field) when it is empty.

Is it something like:

If Me.Notes.Value = 1 Then .... ?


Bart
Access 2003

Bob Quintal

2006-02-19, 3:24 am

"AA Arens" <bartvandongen@gmail.com> wrote in
news:1140312184.374960.203670@o13g2000cwo.googlegroups.com:

> I have button and added the command that places a date and
> some stripes in the Notes-field. That works fine. If there is
> already some text, it places the date at a next line:
>
> Private Sub Command80_Click()
> Me.Notes = Me.Notes & vbCrLf & Format(Date, "dd-mm-yyyy") & "
> ------ " Notes.SetFocus
> Notes.SelStart = Len(Notes.Value)
> End Sub
>
> However, when the Notes field is empty it still places the
> date at the next line, leaving the first line empty. How to
> have the date placed in the upper-left corner (the start of
> the field) when it is empty.
>
> Is it something like:
>
> If Me.Notes.Value = 1 Then .... ?
>
>
> Bart
> Access 2003
>

If len(me.notes)> 0 then
me.notes = me.notes & vbCrLf
end if
me.notes = me.notes & ....

--
Bob Quintal

PA is y I've altered my email address.
Bob Quintal

2006-02-19, 3:24 am

Bob Quintal <rquintal@sympatico.ca> wrote in
news:Xns976EDC7DEC50
8BQuintal@207.35.177.135:

> "AA Arens" <bartvandongen@gmail.com> wrote in
> news:1140312184.374960.203670@o13g2000cwo.googlegroups.com:
>
"[color=darkred]
> If len(me.notes)> 0 then
> me.notes = me.notes & vbCrLf
> end if
> me.notes = me.notes & ....
>

Access may choke on the code above.

If len(me.notes & "") > 0 then
will not.
--
Bob Quintal

PA is y I've altered my email address.
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com