Blank field force entry

S

Spencer

I have three forms:

frmCustomers; frmOrders; sfrmOrder Details

frmCustomers is opened and it has several tabs one of which is for orders
where I have the frmOrders with the subform sfrmOrder Details. On the
frmOrders I have a field labeled ShipDate, and on the subform I have a field
labeled Item. The ship date must be entered before the item so on the Got
Focus event of txtItem I put:

If IsNull(Me.Parent.Controls![ShipDate]) Then
MsgBox "You must enter a ship date"
Me.Parent.Controls![ShipDate].SetFocus
End If

This worked until I closed the form and reopened the main form,
frmCustomers. Before opening the form the message box poped up saying I had
to enter the ship date. How do I keep the message box from appearing until I
go to frmOrders and enter data?

Thanks in advance for your help.


I have a form called frmCustomers. In this form I have several tabs one of
which is for orders. The order form, called frmOrders, has a subform called
sfrmOrder Details. frmOrders requires that a ship date be entered before item
details in the subform can be entered. To prevent entering of data before the
ship date is entered on the Got Focus event on txtItemin the subform,
sfrmOrder Details,
 
S

Spencer

It is still doing the same thing. Plus I have to be able to stop the person
from entering any data before the ship date is entered. Any idea?

Al Campagna said:
Spencer,
Try using your code in the OnEnter event of Item.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Spencer said:
I have three forms:

frmCustomers; frmOrders; sfrmOrder Details

frmCustomers is opened and it has several tabs one of which is for orders
where I have the frmOrders with the subform sfrmOrder Details. On the
frmOrders I have a field labeled ShipDate, and on the subform I have a field
labeled Item. The ship date must be entered before the item so on the Got
Focus event of txtItem I put:

If IsNull(Me.Parent.Controls![ShipDate]) Then
MsgBox "You must enter a ship date"
Me.Parent.Controls![ShipDate].SetFocus
End If

This worked until I closed the form and reopened the main form,
frmCustomers. Before opening the form the message box poped up saying I had
to enter the ship date. How do I keep the message box from appearing until I
go to frmOrders and enter data?

Thanks in advance for your help.


I have a form called frmCustomers. In this form I have several tabs one of
which is for orders. The order form, called frmOrders, has a subform called
sfrmOrder Details. frmOrders requires that a ship date be entered before item
details in the subform can be entered. To prevent entering of data before the
ship date is entered on the Got Focus event on txtItemin the subform,
sfrmOrder Details,
 
J

J. Goddard

Check that tab order of the controls of the orders sub-form (In design
view, Click View-Tab order... The order of the controls must be such
that users don't go to the txtItem field first.

The reason is that when you open ftmCustomers, the frmOrders opens too,
and when you open the orders form, the sub-form is automatically opened
too, and if the cursor goes to the txtItem field first, it triggers the
error.

If you cannot change the tab order on the sub-form, a quick fix might be
to put =date() as the default value for shipdate on the orders form.

HTH

John


It is still doing the same thing. Plus I have to be able to stop the person
from entering any data before the ship date is entered. Any idea?

:

Spencer,
Try using your code in the OnEnter event of Item.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I have three forms:

frmCustomers; frmOrders; sfrmOrder Details

frmCustomers is opened and it has several tabs one of which is for orders
where I have the frmOrders with the subform sfrmOrder Details. On the
frmOrders I have a field labeled ShipDate, and on the subform I have a field
labeled Item. The ship date must be entered before the item so on the Got
Focus event of txtItem I put:

If IsNull(Me.Parent.Controls![ShipDate]) Then
MsgBox "You must enter a ship date"
Me.Parent.Controls![ShipDate].SetFocus
End If

This worked until I closed the form and reopened the main form,
frmCustomers. Before opening the form the message box poped up saying I had
to enter the ship date. How do I keep the message box from appearing until I
go to frmOrders and enter data?

Thanks in advance for your help.


I have a form called frmCustomers. In this form I have several tabs one of
which is for orders. The order form, called frmOrders, has a subform called
sfrmOrder Details. frmOrders requires that a ship date be entered before item
details in the subform can be entered. To prevent entering of data before the
ship date is entered on the Got Focus event on txtItemin the subform,
sfrmOrder Details,
 
A

Al Campagna

Spencer,
That doesn't add up...
Did you remove the code from the GotFocus of Item?
Did you add code similar to this to the Item OnEnter event of Item?

Private Sub Item_Enter()
If IsNull(ShipDate) Then
Beep
MsgBox "Must Enter Ship Date",vbOkOnly, "Missing Data"
DoCmd.GotoControl "ShipDate"
Else
Exit Sub
End If
End Sub

This will work if your setup is as indicated...
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Spencer said:
It is still doing the same thing. Plus I have to be able to stop the person
from entering any data before the ship date is entered. Any idea?

Al Campagna said:
Spencer,
Try using your code in the OnEnter event of Item.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Spencer said:
I have three forms:

frmCustomers; frmOrders; sfrmOrder Details

frmCustomers is opened and it has several tabs one of which is for orders
where I have the frmOrders with the subform sfrmOrder Details. On the
frmOrders I have a field labeled ShipDate, and on the subform I have a field
labeled Item. The ship date must be entered before the item so on the Got
Focus event of txtItem I put:

If IsNull(Me.Parent.Controls![ShipDate]) Then
MsgBox "You must enter a ship date"
Me.Parent.Controls![ShipDate].SetFocus
End If

This worked until I closed the form and reopened the main form,
frmCustomers. Before opening the form the message box poped up saying I had
to enter the ship date. How do I keep the message box from appearing until I
go to frmOrders and enter data?

Thanks in advance for your help.


I have a form called frmCustomers. In this form I have several tabs one of
which is for orders. The order form, called frmOrders, has a subform called
sfrmOrder Details. frmOrders requires that a ship date be entered before item
details in the subform can be entered. To prevent entering of data before the
ship date is entered on the Got Focus event on txtItemin the subform,
sfrmOrder Details,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top