Eljefegeneo
Still trying to learn
- Local time
- Yesterday, 19:38
- Joined
- Jan 10, 2011
- Messages
- 904
I have a billing database where I want to change a quote or greeting that is displayed on an invoice which I can change at will. I tried all different kinds of options but finally figured out something that would work. But I am not sure if I am doing it correctly.
The Main menu has an unbound text box on which the text to display on the invoice is shown. I wanted to be able to change the default value of this unbound text box [txtquote] so that I could use the current text or change it. And I know that I have to set the default value of a text box when the form is in design view. It seems that you have to have at least one other form open for you to open another form in design view and change the default value without throwing an error message.
So my only recourse was to have a pop-up form [frmChangeText] bound by a new table on which I could enter my new text to display on the main form from which I could reference on my invoices.
Without the new table albeit only a record Id and one field, the code wouldn't work. And I had to include the second to last line of the code or I would be the dreaded #Name? error.
Is this the correct method of doing this? It just seems very clumsy to me.
The Main menu has an unbound text box on which the text to display on the invoice is shown. I wanted to be able to change the default value of this unbound text box [txtquote] so that I could use the current text or change it. And I know that I have to set the default value of a text box when the form is in design view. It seems that you have to have at least one other form open for you to open another form in design view and change the default value without throwing an error message.
So my only recourse was to have a pop-up form [frmChangeText] bound by a new table on which I could enter my new text to display on the main form from which I could reference on my invoices.
Code:
Forms!frmMainMenu!txtquote = Me.txtquote
DoCmd.Close acForm, "frmMainMenu"
DoCmd.OpenForm "frmMainMenu", acDesign, , , acFormPropertySettings, acWindowNormal
Forms!frmMainMenu!txtquote.DefaultValue = """" & Me.txtquote.Value & """"
DoCmd.Close acForm, "frmMainMenu", acSaveYes
DoCmd.OpenForm "frmMainMenu"
Forms!frmMainMenu!txtquote = Me.txtquote
DoCmd.Close acForm, "frmChangeText"
Is this the correct method of doing this? It just seems very clumsy to me.