in
in
Posted via a free Usenet account
fromhttp://
www.teranews.com-Hidequoted text -
- Show quoted text -
Found the problem, the text box that will not accept the
"Clear Me" option is the MachineName box. This is the
box that is loaded from a subform which runs a query off
the MachineNumber combo box to load this text box. So I
guess I need to clear this text independant of this code
and figure out how to write the "If Me.NewRecord...." for
the DMax auto number function.
I removed the "Clear Me" tag from the MachineName text
box and the rest of the form clears as it should.
Congratulations, you're making progress.
Do you need to clear this combobox? I think that if you
simply clear the combobox, that it would clear this
calculated textbox too.
As to the
If Me.newrecord then
me.txtAutonumber = nz(Dmax("field","table"),0)+1
end if
is the template you should use. Change the field and table
entries to the real names, and that should work.
--
Bob Quintal
PA is y I've altered my email address.
--
Thank you Bob....where would this template go? It doesn't
work in the forms "on Current" event where I have the
Me.KaizenNumber = Nz(DMax("KaizenNumber",
"KaizenTrackingtbl"), 0) + 1
Which was the original code used to create the auto-number.
If I turn this line "off" then I do not get an auto number
at all when I open the form.
It dawned on me that you don't need the IF me.newrecord
because your form is unbound, if I recall correctly.
As for the text box, yes I do need to clear it. The combo
box that the subform feeds off of clears just fine. So I
went to the sub form and tried to tag it with the "Clear Me"
but the text box remained populated....Not sure where to go
from here....
No, you can't clear a subform. Perhaps a me.combobox.requery
or a subform.requery would work to clear the textbox..
--
Bob Quintal
PA is y I've altered my email address.
--
-
Hide quoted text -
- Show quoted text -
Yes the form is unbound, but the DMax() function generates a
new number on current, but not after I submit. How can I get
it to generate a new number after submit? Should I place it in
the after update event as well?
As for the the text box that feeds off the Equipment subform,
there is a subform requery after update on the combo box:
Private Sub MachineNumber_AfterUpdate()
Forms![KaizenTrackingfrm].[Equipmentsubform].Requery
End Sub
I will keep researching........
Yes, place it in the code that does the write of the data, as
part of the clearing routine.
You could try adding the requery line there too, as an
afterUpdate event does not get triggered when you change the
combobox using code.
Q