well, i figured it out

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

I'd like to thank you all for taking the time to help. But you didn't, so I
can't.

thanks for nothing.
 
Jimmy said:
I'd like to thank you all for taking the time to help. But you didn't, so I
can't.


Don't be nasty. I tried to figure a way, but didn't come up
with anything. I would appreciate it is you would share
your solution with the rest of us that don't have the
answer.
 
I couldn't figure it out. What's the answer?

BTW answers can take more than 12 hours to be worked out...
 
Nick Coe (UK) said:
I couldn't figure it out. What's the answer?

Nick,
I think my response to the OP's original Q in the Thread in which it was asked
(which BTW is where this thread belongs besides being impolite) may be the
answer...
 
MikeB said:
I think my response to the OP's original Q in the Thread in which it was asked
(which BTW is where this thread belongs besides being impolite) may be the
answer...


Oh bleep. That's way too easy, Mike.

I probably never would have thought of that since I've never
used SetWarnings in an application. Amazing what blind
spots creep in over the years.
 
the DoCmd.SetWarnings False was what i'd figured out on my own.

i'm sorry for getting cranky, i've been working on this for days, and i'm
running out of time... quickly.

after i found the docmd.setwarnings thing though, an odd thing happened.
the exact same code works wonderfuly for some fields, and not at all for
others. here's what i've got.

Private Sub French_word_Exit(Cancel As Integer)
'It runs when the text box has data
With Me.French_Word
..SetFocus
..SelStart = 0
..SelLength = Len(Me.French_Word)
End With
DoCmd.SetWarnings False

DoCmd.RunCommand acCmdSpelling
End Sub

which works....


Private Sub imperfect_first_p_plural_exit(Cancel As Integer)
With Me.imperfect_first_p_plural
..SetFocus
..SelStart = 0
..SelLength = Len(Me.imperfect_first_p_plural)
End With
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
End Sub

which gives me a runtime error 94 invalid use of null

idealy, i'd like to write a public sub... but i can't figure out how to pass
the name of the field to the with command

again, my appologies.
 
well, i'm going to bed.

this is what i've got so far on the public sub

in addition to the code below i''ve tried a couple of different ways of
writing the with command... but no luck... if i could just get the name of
the field to the with input...

Private Sub French_word_Exit(Cancel As Integer)

Dim fieldname As String

spellcheck (Me.French_Word)
'spellcheck(me.French_Word)
'spellcheck(me.French_Word.name)


End Sub


Public Sub spellcheck(FieldName)
'It runs when the text box has data
With Fieldname
..SetFocus
..SelStart = 0
..SelLength = Len(FieldName)
End With
DoCmd.SetWarnings False

DoCmd.RunCommand acCmdSpelling
End Sub
 
Jimmy said:
well, i'm going to bed.

this is what i've got so far on the public sub

in addition to the code below i''ve tried a couple of different ways of
writing the with command... but no luck... if i could just get the name of
the field to the with input...

Private Sub French_word_Exit(Cancel As Integer)

Dim fieldname As String

spellcheck (Me.French_Word)
'spellcheck(me.French_Word)
'spellcheck(me.French_Word.name)
End Sub


Public Sub spellcheck(FieldName)
'It runs when the text box has data
With Fieldname
.SetFocus
.SelStart = 0
.SelLength = Len(FieldName)
End With
DoCmd.SetWarnings False

DoCmd.RunCommand acCmdSpelling
End Sub


You're getting mixed up between the control object and its
Name property. Let's use the object approach:

Private Sub French_word_Exit(Cancel As Integer)
spellcheck (Me.French_Word)
End Sub

Public Sub spellcheck(ctl As Control)
If IsNull(ctl) Then Exit Sub
With ctl
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With

DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSpelling
DoCmd.SetWarnings True

End Sub

Note the SetWarnings True, you don't want to leave warnings
off all the time.
 
You're getting mixed up between the control object and its
Name property. Let's use the object approach:


<- gets blank stare

um... i hate it when i do that?

anyway, still no workie workie... i notice that its passing the value
"donner" (french word for "to give") which means its passing the value not
the name of the field... but i think you're saying that i shouldn't have
been passing the name of the field anyway... and you don't seem to be using
it that way.

in many unix scripting languages you can pass a command to the OS, if this
were sh, i'd just do something like this

GDctl = me.french_word

with 'print GDctl'
dostuff
end with

can i do anything like that?
 
Hi,
Remove the brackets:
spellcheck Me.French_Word

this will pass the object to your sub

or you can do this:
Call spellcheck (Me.French_Word)



--
HTH
Dan Artuso, Access MVP


Jimmy said:
You're getting mixed up between the control object and its
Name property. Let's use the object approach:


<- gets blank stare

um... i hate it when i do that?

anyway, still no workie workie... i notice that its passing the value
"donner" (french word for "to give") which means its passing the value not
the name of the field... but i think you're saying that i shouldn't have
been passing the name of the field anyway... and you don't seem to be using
it that way.

in many unix scripting languages you can pass a command to the OS, if this
were sh, i'd just do something like this

GDctl = me.french_word

with 'print GDctl'
dostuff
end with

can i do anything like that?
 
Dan Artuso said:
Hi,
Remove the brackets:
spellcheck Me.French_Word

this will pass the object to your sub

or you can do this:
Call spellcheck (Me.French_Word)

thanks dan, it seems to have worked, i still have to write the subs for the
other 40 fields, but that should work great!

marshal, i think your

If IsNull(ctl) Then Exit Sub

would have fixed my original problem if i'd kept all the private subs, and
it should prevent the problem from comming up with the public sub.

all in all, i was too hard on y'all. Thank you so much you were a great
help... i'll let you know if it all works:)

thanks again.


Jimmy
 
Jimmy said:
thanks dan, it seems to have worked, i still have to write the subs for the
other 40 fields, but that should work great!

marshal, i think your

If IsNull(ctl) Then Exit Sub

would have fixed my original problem if i'd kept all the private subs, and
it should prevent the problem from comming up with the public sub.

all in all, i was too hard on y'all. Thank you so much you were a great
help... i'll let you know if it all works:)

I can think of a couple of NG where you would have gotten a proper spanking
before you would have gotten the excellent help these guys have given.! ;-)
 
Back
Top