Yet another "enter parameter value" popup

  • Thread starter Matt C via AccessMonster.com
  • Start date
M

Matt C via AccessMonster.com

I have a main startup form
When you click a button, it brings up the "companies" form
when I click the "done" command button, it tests to see if the current record
has been changed and asks if the user wishes to confirm changes:
if changes confirmed, it saves the record then calls DoCmd.close
If changes denied, it undoes the record then calls DoCmd.close
if no changes has been made it calls Do Cmd.close
if cancel is hit, it exits the sub without any changes.

When exiting the companies form this way, the "enter parameter value" popup
appeas asking for [Forms]![Companies]![Company ID]

Unless the form is on a new record, any reference to this value is obtained
by the textbox on the form.

what's bizarre, is this popup only occurs when using the button, if I exit
the form with the built in [ x ] button, the popup doesn't appear (I don't
want to close forms this way as it doesn't comfirm changes.)

This lead me to beleive that there may have been a problem with the code
behind the button, but even if I comment out every last bit of code except
the DoCmd.close line, it still comes up with the popup message.

I tried creating a new button, where all it did was DoCmd.close, and even
that comes up with the error message, and yet clicking the [ x ] doesn't.
Does anyone have any ideas?
 
B

Brian

Check these four places for references to [Forms]![Companies]![Company ID]:

Any queries being called?
Any direct reference to [Forms]![Companies]![Company ID] in your code for
that form (i.e. in Form_BeforeUpdate, etc.)?
RecordSource of the form or another form that depends on having this one
open(filtered by [Forms]![Companies]![Company ID])?
Any controls on the form having [Forms]![Companies]![Company ID] in their
record/row sources?

Matt C via AccessMonster.com said:
I have a main startup form
When you click a button, it brings up the "companies" form
when I click the "done" command button, it tests to see if the current record
has been changed and asks if the user wishes to confirm changes:
if changes confirmed, it saves the record then calls DoCmd.close
If changes denied, it undoes the record then calls DoCmd.close
if no changes has been made it calls Do Cmd.close
if cancel is hit, it exits the sub without any changes.

When exiting the companies form this way, the "enter parameter value" popup
appeas asking for [Forms]![Companies]![Company ID]

Unless the form is on a new record, any reference to this value is obtained
by the textbox on the form.

what's bizarre, is this popup only occurs when using the button, if I exit
the form with the built in [ x ] button, the popup doesn't appear (I don't
want to close forms this way as it doesn't comfirm changes.)

This lead me to beleive that there may have been a problem with the code
behind the button, but even if I comment out every last bit of code except
the DoCmd.close line, it still comes up with the popup message.

I tried creating a new button, where all it did was DoCmd.close, and even
that comes up with the error message, and yet clicking the [ x ] doesn't.
Does anyone have any ideas?
 
M

Matt C via AccessMonster.com

Brian said:
Check these four places for references to [Forms]![Companies]![Company ID]:
Any queries being called?
Any direct reference to [Forms]![Companies]![Company ID] in your code for
that form (i.e. in Form_BeforeUpdate, etc.)?
RecordSource of the form or another form that depends on having this one
open(filtered by [Forms]![Companies]![Company ID])?
Any controls on the form having [Forms]![Companies]![Company ID] in their
record/row sources?

I have checked those places and still i can find nothing

Does it seem strange that the popup will only appear if the startup form
(which calls the companies form) is open? If I open the companies for
independantly and close with the done button.... no popup
 
B

Brian

Can you post the full code from your Done button (actually, why not the full
code for the Companies form) and the record source SQL for your Companies
form?

Thanks.

Matt C via AccessMonster.com said:
Check these four places for references to [Forms]![Companies]![Company ID]:
Any queries being called?
Any direct reference to [Forms]![Companies]![Company ID] in your code for
that form (i.e. in Form_BeforeUpdate, etc.)?
RecordSource of the form or another form that depends on having this one
open(filtered by [Forms]![Companies]![Company ID])?
Any controls on the form having [Forms]![Companies]![Company ID] in their
record/row sources?

I have checked those places and still i can find nothing

Does it seem strange that the popup will only appear if the startup form
(which calls the companies form) is open? If I open the companies for
independantly and close with the done button.... no popup
 
M

Matt C via AccessMonster.com

Brian said:
Can you post the full code from your Done button (actually, why not the full
code for the Companies form) and the record source SQL for your Companies
form?

Thanks.
Check these four places for references to [Forms]![Companies]![Company ID]:
[quoted text clipped - 11 lines]
(which calls the companies form) is open? If I open the companies for
independantly and close with the done button.... no popup




done button:


Private Sub exitForm_Click()

If Change = True Then
Dim ConfirmMessage As VbMsgBoxResult
ConfirmMessage = MsgBox("Are you sure you want to save changes?",
vbYesNoCancel, "Confirmation")
If ConfirmMessage = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.Close
Else
If ConfirmMessage = vbNo Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
End If
End If
Else
DoCmd.Close
End If
End Sub
 
B

Brian

Record Source SQL: just highlight the entire recordsource entry and
copy/paste. Alternatively, click the ellipsis to the right of the
RecordSource line, which will open it in query view, then switch from design
view to SQL view to show the SQL statement.

No attachment service, but if you want to e-mail me more on this one:

brainy
at
pacifier
dot com

(you can figure out the address syntax here - just hiding from the robots &
spammers)

Matt C via AccessMonster.com said:
Can you post the full code from your Done button (actually, why not the full
code for the Companies form) and the record source SQL for your Companies
form?

Thanks.
Check these four places for references to [Forms]![Companies]![Company ID]:
[quoted text clipped - 11 lines]
(which calls the companies form) is open? If I open the companies for
independantly and close with the done button.... no popup




done button:


Private Sub exitForm_Click()

If Change = True Then
Dim ConfirmMessage As VbMsgBoxResult
ConfirmMessage = MsgBox("Are you sure you want to save changes?",
vbYesNoCancel, "Confirmation")
If ConfirmMessage = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.Close
Else
If ConfirmMessage = vbNo Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
End If
End If
Else
DoCmd.Close
End If
End Sub
 

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