View Full Version : Enter Parameter Value?


Paul Cooke
11-10-2001, 12:52 AM
I have entered some code to enable a text box called "disposal" (which is set as disabled by default) if the preceding combo box is selected as "No" from a chice of Yes or No

i.e

Private Sub Conwork_AfterUpdate()
If Me!Conwork = "No" Then
Me!Disposal.Enabled = True
Else
Me!Disposal.Enabled = False
End If

End Sub

Once the "disposal" box is highligted I am able to enter text into it, but when I click on a command button to print the current report a window appears called Enter Parameter value "disposal11"

If I enter any text in this window and press OK it is printed on my report.

If I click OK without entering text in this window the report is printed but the "disposal" field on the report is blank regardless of any text that was entered on the form.

If I click cancel on the window it closes the window and i return to the form.

To say this is bugging me is an understatement so please help if you can!!

Thanks

Rich
11-10-2001, 02:34 AM
I'd say the field hasn't been saved, try adding DoCmd.RunCommand acCmdSaveRecord
to the command button before opening the report

Paul Cooke
11-10-2001, 02:39 AM
I have had a look at the command button here is the code thats on it

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

stDocName = "Accident Report"
DoCmd.OpenReport stDocName, acNormal, , "[Serial_Number] = [forms]![Accident Report Form]![Serial_Number]"

DoCmd.Close acForm, "Accident Report Form"

stDocName = "Switchboard"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Exit_Command56_Click:
Exit Sub

Err_Command56_Click:
MsgBox Err.Description
Resume Exit_Command56_Click

End Sub

I noticed that "save record" command is already in this code would I need to add the line you suggested as well?

sorry to be a pain!

Rich
11-10-2001, 04:13 AM
What's the record source of the report?

Paul Cooke
11-10-2001, 05:30 AM
Sorry could you eloborate on what you mean my knowledge on Access is basic (I'm surprised I've got a far as I have)!

Rich
11-10-2001, 06:35 AM
Send me a zipped copy and I'll take a look. Make sure you compact before zip and it will have to be in acc97.

jwindon
11-10-2001, 07:14 AM
I'm thinking...the Report "Accident Report" is built off a query. The same query as the form.

If the field [disposal] is part of the query and is disabled, the query still wants a value for that field?

Perhaps, locking the field would be a better option.

Paul Cooke
11-14-2001, 04:59 AM
Thanks for the replies! Rich thanks for your offer but I can't email you as your email link isn't shown.

Jwindon, if I lock the field how do I get it to unlock depending on the answer to the previous question field?

Paul Cooke
11-14-2001, 05:24 AM
Now don't I feel a fool!!

I looked through the Accident Report and found the "diposal" field it was hidden!!

Sorry guys but thank you very much for taking the time to try and help.

regards