I have form for entering new records into a table. Each time the form is opened, one value (mailing) will remain the same for all records entered during that session. I'd like to have an inputbox pop up when the form is opened asking for the value, set the DefaultValue of that field, and display it in the forms' header. When the form is closed and subsequently opened again, I'd like the inputbox to appear again, and the default value to change accordingly.
I have the following in the 'On Open' event of the form:
I am writing, because this does not work. I get a #Name? Message in the control box. I've tried several things (using quotes, putting the box in the detail section, moving the code to the 'On Enter' event of the box itself, etc.) but can't find a way to make this work. Can anyone help me and tell me what I'm doing wrong? Shouldn't this be simple? Thanks
Jeff
I have the following in the 'On Open' event of the form:
Private Sub Form_Open(Cancel As Integer)
Dim strMlgCde As String
strMlgCde = InputBox("Enter mailing code (month year)", "Enter Mailing Code")
Mailing.DefaultValue = strMlgCde
End Sub
I am writing, because this does not work. I get a #Name? Message in the control box. I've tried several things (using quotes, putting the box in the detail section, moving the code to the 'On Enter' event of the box itself, etc.) but can't find a way to make this work. Can anyone help me and tell me what I'm doing wrong? Shouldn't this be simple? Thanks
Jeff