Cannot "Find" records while in a form

e_lady

Registered User.
Local time
Today, 06:50
Joined
Feb 10, 2004
Messages
14
I have an Invoice form with Customer ID and info fields. The Customer ID field is a combo box. If the Customer ID is not found the user can then double click on it to bring up the Customer form in order to add this to the Customer table.

On the Customer form I have a Find button. The user needs to lookup ID's in order not to create a duplicate. This Find button functions correctly if the user just goes into the Customer form.

If the user is in the Invoice form and double clicks on the Customer ID field, the Customer form appears. They can add and scroll through the list, but if they click on the Find button, a message appears - "Find isn't available now"

Have I forgotten to add something?
 
I would suspect that when you open the form with the command button, that the form is loaded with the property "data entry" = Yes

Could you post the code behind the command button?

And it might be an idea to post the address forms "load event" code if it has some.
 
Here is the code to open the form with a double click:

Private Sub CID_DblClick(Cancel As Integer)
On Error GoTo Err_CID_DblClick

DoCmd.OpenForm "CUSTOMER", , , , , acDialog, "GotoNew"
Me![CID].Requery

Exit_CID_DblClick:
Exit Sub

Err_CID_DblClick:
MsgBox Err.Description
Resume Exit_CID_DblClick
End Sub

On the Customer Form, the code behind the Find button is:

Private Sub Command25_Click()
On Error GoTo Err_Command25_Click

Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Command25_Click:
Exit Sub

Err_Command25_Click:
MsgBox Err.Description
Resume Exit_Command25_Click

End Sub



The Customer form has the Data Entry Property set to No.

Hope that helps
 
Last edited:
e_lady,

Look at what the Customer form does in its OnOpen or OnLoad event.
The value "GotoNew" is passed to it with the OpenArgs parameter when
you launch the form.

DoCmd.OpenForm "CUSTOMER", , , , , acDialog, "GotoNew"

When you just run the form, you don't pass it "GotoNew", that's why you
get a difference.

Wayne
 

Users who are viewing this thread

Back
Top Bottom