Why won't my form close?!!!

angelac

Registered User.
Local time
Today, 12:15
Joined
May 22, 2001
Messages
13
I have a form that is used to lookup records for a variety of criteria, using "find" command buttons. I just added three more buttons and they all work fine to find my records. The problem is once the record is displayed(in a separate form)and I use a command button terminate the record, I get a parameter box prompting for the criteria I used in the lookup form. I think it may be because the form isn't closed. Could this be it? Please, I need help.I'd be happy to provide more info if needed...
 
I have a similar problem.....
I am trying to close a form automatically after a user has selected a record to be opened in another form.

Could someone please give us and hand with our problems, Thnx.

Here is my code:

Private Sub Listofdomainnames_Click()
On Error GoTo Err_Listofdomainnames_Click

Dim stDocName As String
Dim rst As Recordset, strCriteria As String
stDocName = "RealForm"


strCriteria = "[Domain]=" & "'" & Me![Listofdomainnames] & "'"
DoCmd.OpenForm stDocName

Set rst = Forms!RealForm.RecordsetClone
rst.FindFirst strCriteria
Forms!RealForm.Bookmark = rst.Bookmark

DoCmd.close acForm, "Search"

Exit_Listofdomainnames_Click:
Exit Sub

Err_Listofdomainnames_Click:
MsgBox Err.Description
Resume Exit_Listofdomainnames_Click


End Sub

I get the prompt :

Enter parameter Value
Forms!Search!txtsearchstring

What is this telling me??

Thnx in advance for any help,
Angelo



[This message has been edited by Angello Pimental (edited 06-12-2001).]
 
a quick easy way to solve this problem is to close the form using the "On Open" event of the second form...
 
Actually I still get the same problem...........
Does anyone else have a solution???

Thnx
 
Is your Search form based on a query with Forms!Search!txtsearchstring as a criteria for anything?

Or another possibility is one of your controls on the form you are opening is refering to a field on your Search form.

The first thing I would do is check to see if this field actually exists on your Search form. I would bargain that it doesn't.

If you can't figure it out, feel free to email the database to me to take a peek at.

~Charity
 
Charity,

Yes, my search form is based on a query, and Forms!Search!txtsearchstring is a criteria.

But, how would this have an affect on closing the form? And why would I be prompted to enter a paramater value for Forms!Search!txtsearchstring?

If it makes any difference, even if I base the search form on a table I still get the same prompt.

Is there a way that I can get the code to stop running once a user selects the record he/she wants to view? In that way the user wouldn't be prompt again.

Thnx for your help.
Angelo

p.s. I can just make the prompt invisible, "Out of sight, out of mind"?
 
Ok. I'm thinking out loud so excuse anything that doesn't make too much sense.

I seems that if you are getting this parameter prompt on the close of the form, then something other than the Search form is looking for the criteria. It would be prompting, because it can no longer find the txtsearch string on the Search form.

Is the Search form actually closing, or are you getting the prompt before it closes?

You've got me really interested...I would love to look at the DB if it's ok with you. You can delete any sensitive data...

~Charity
 
Charity,

I have e-mailed you a sample of the database,
Thank you for having a look,

Cheers,

Angelo
 
For those of you following this post, the culprit was a missing line of code setting the listcontrol="" before closing the form. If omitted, the listbox is still trying to requery based on the criteria "Forms!Search!txtsearchstring" (hence the parameter prompt).
 

Users who are viewing this thread

Back
Top Bottom