RE: How to insert date at caret position in text control.



Sorry, I initially should have said my code made garbage.

OK

sDate = "abc-xyz" makes it repeat endlessly until stack space runs out.

Others are too hard to explain.


--
Regards
Tom


"'69 Camaro" wrote:

> > Same problem with your code as with mine.
>
> Your code made "nothing" happen. My code made garbage. ;-)
>
> For each of the four examples given, what did the garbage string look like?
> And was there an error message?
>
> HTH.
> Gunny
>
> See http://www.QBuilt.com for all your database needs.
> See http://www.Access.QBuilt.com for Microsoft Access tips.
>
> (Please remove ZERO_SPAM from my reply E-mail address so that a message will
> be forwarded to me.)
> - - -
> If my answer has helped you, please sign in and answer yes to the question
> "Did this post answer your question?" at the bottom of the message, which
> adds your question and the answers to the database of answers. Remember that
> questions answered the quickest are often from those who have a history of
> rewarding the contributors who have taken the time to answer questions
> correctly.
>
>
> "ThomasAJ" wrote:
>
> > Same problem with your code as with mine.
> >
> > The problem is that if 'sDate' contains anything other than alpha characters
> > then what is sent is garbage.
> >
> > eg sDate = "123" and I get garbage.
> > sDate = "abc" then works fine
> > sDate = "01/01/2005" then garbage
> > sDate = "abc-xyz" then garbage
> >
> > Any ideas.
> >
> > --
> > Regards
> > Tom
> >
> >
> > "'69 Camaro" wrote:
> >
> > > Hi, Tom.
> > >
> > > Try:
> > >
> > > Private Sub txtSomeValue_KeyDown(KeyCode As Integer, Shift As Integer)
> > >
> > > On Error GoTo ErrHandler
> > >
> > > Dim sDate As String
> > > Dim nAltKey As Integer
> > >
> > > sDate = "10/31/2005"
> > > nAltKey = (Shift And acAltMask) > 0
> > >
> > > If (nAltKey And (Chr(KeyCode) = "d")) Then
> > > SendKeys sDate, False
> > > End If
> > >
> > > Exit Sub
> > >
> > > ErrHandler:
> > >
> > > MsgBox "Error in txtSomeValue_KeyDown( ) in " & _
> > > vbCrLf & Me.Name & " form." & vbCrLf & vbCrLf & _
> > > "Error #" & Err.Number & vbCrLf & Err.Description
> > > Err.Clear
> > >
> > > End Sub
> > >
> > > . . . where txtSomeValue is the name of the text box needing the date
> > > inserted at the caret whenever <ALT><D> is pressed on the keyboard.
> > >
> > > HTH.
> > > Gunny
> > >
> > > See http://www.QBuilt.com for all your database needs.
> > > See http://www.Access.QBuilt.com for Microsoft Access tips.
> > >
> > > (Please remove ZERO_SPAM from my reply E-mail address so that a message will
> > > be forwarded to me.)
> > > - - -
> > > If my answer has helped you, please sign in and answer yes to the question
> > > "Did this post answer your question?" at the bottom of the message, which
> > > adds your question and the answers to the database of answers. Remember that
> > > questions answered the quickest are often from those who have a history of
> > > rewarding the contributors who have taken the time to answer questions
> > > correctly.
> > >
> > >
> > > "ThomasAJ" wrote:
> > >
> > > > In the Form's KeyDown event I test for say 'Alt D' thus:
> > > >
> > > > blnAlt = (Shift And acAltMask)
> > > >
> > > > then if TRUE I perform
> > > >
> > > > If KeyCode = vbKeyD Then SendKeys strDate, True
> > > >
> > > > where strDate contains a date.
> > > >
> > > > However nothing happens. What am I missing?
> > > >
> > > > --
> > > > Regards
> > > > Tom
.



Relevant Pages

  • RE: How to insert date at caret position in text control.
    ... What happens if you change the character to something other than "D"? ... See http://www.QBuilt.com for all your database needs. ... I initially should have said my code made garbage. ... >>> Tom ...
    (microsoft.public.access.modulesdaovba)
  • Re: language help (OT????)
    ... of buyers from their database. ... Regards, ... Tom ... Prev by Date: ...
    (rec.collecting.coins)
  • Re: win 2003 setup
    ... Regards ... >> I am just setting up a 2003 server in a test invir to learn it. ... >> Tom,, aka Qwiz ...
    (microsoft.public.windows.server.setup)
  • Re: OPA349 spice model acting weird
    ... >>Hello Tom, ... >>Best regards, ... model before I spend money for unknown quality. ... Helmut ...
    (sci.electronics.design)
  • Re: Using ColumnNumber in Range syntax
    ... > Hi Norman and Tom, ... > to have the ability to use range syntax within a FOR loop whose counter is ... >> Regards, ...
    (microsoft.public.excel.programming)

Quantcast