Are we on a new orderitem ?

odrap

Registered User.
Local time
Today, 04:53
Joined
Dec 16, 2008
Messages
156
In a parentform frmOrders with a subform sfrmOrders, it is easy to find out by code when we are on a new record ( = new order), by using Me.NewRecord.
But i also want to find out by code when we are on a new record (= an empty line in the subform to enter a new orderitem.
I tried the following code in the current event of the subform
if me.newrecord then
msgbox " We are on a new orderitem"
end if
but the result isn't what i expected.
Each time i enter an ordernumber in the parent form, the message shows up, even the fact that on this moment we aren't on a new orderitem! But when I navigate from an orderitem to the first control of a new orderitemline to fill in a new orderitem, no message appears!
I need to know that we are on a neworderitem, because this is a condition i use in the code to execute some function.
What to do to find out that we are on a new orderitem?
 
Hi,

What about:

If IsNull(Me![YourControl]) Then
DoCmd.whatever_you_want

Chould be in the OnLoad or OnOpen have a play :)

Good luck John

EDIT:

Or if a subform control

If (IsNull(Forms!YourMainForm!YourSubForm.Form.YourControl.Value)) Then
DoCmd.Whater_you_want
 
Last edited:
Thanks for the help
 

Users who are viewing this thread

Back
Top Bottom