Hello,
I have a unique situation, I believe. I have a form with unbound textboxes (frmEditReport) - most populate from a search query but one unbound textbox, txt_ReturnInfo, populates based on a selection the user chooses when logging in (code below). Basically, the user selects their office at login and the textbox will populate with the appropriate return mailing address when frmEditReport opens.
I think this is most efficient since the user will generally login in the morning but reopen this form several times throughout the day.
My situation is that I also want to provide the ability to change the return address from within frmEditReport. I added a combobox (cboOffice) that listed the three possible locations. Is there a simple way to let the selection in that combo box override the text that is already in txt_ReturnInfo?
Thanks for any ideas!
[CODE=vb]Private Sub returnDefault(r eturnType)
'Set default value for return address section depending on the office selected by the user at login or as selected on screen (bmc 02/13/08)
Dim crQ As String
Dim crL As String
crQ = Chr$(34)
crL = vbNewLine
'If Me.cboOffice.Vi sible = True Then
'txt_ReturnInfo .Value = ? Needs to return the correct office address.
'Else
If Forms![frmMainmenu]!txtOffice = "Cincinnati " Then
txt_ReturnInfo. Value = "company name" & crL _
& "address1" & crL _
& "city1, state1, zip1" & crL _
& "website"
ElseIf Forms![frmMainmenu]!txtOffice = "Cleveland" Then
txt_ReturnInfo. Value = "company name" & crL _
& "address2" & crL _
& "city2, state2, zip2" & crL _
& "website"
ElseIf Forms![frmMainmenu]!txtOffice = "Columbus" Then
txt_ReturnInfo. Value = "company name" & crL _
& "address3" & crL _
& "city3, state3, zip3" & crL _
& "website"
Else
txt_ReturnInfo. Value = ""
End If
'End If
End Sub[/CODE]
I have a unique situation, I believe. I have a form with unbound textboxes (frmEditReport) - most populate from a search query but one unbound textbox, txt_ReturnInfo, populates based on a selection the user chooses when logging in (code below). Basically, the user selects their office at login and the textbox will populate with the appropriate return mailing address when frmEditReport opens.
I think this is most efficient since the user will generally login in the morning but reopen this form several times throughout the day.
My situation is that I also want to provide the ability to change the return address from within frmEditReport. I added a combobox (cboOffice) that listed the three possible locations. Is there a simple way to let the selection in that combo box override the text that is already in txt_ReturnInfo?
Thanks for any ideas!
[CODE=vb]Private Sub returnDefault(r eturnType)
'Set default value for return address section depending on the office selected by the user at login or as selected on screen (bmc 02/13/08)
Dim crQ As String
Dim crL As String
crQ = Chr$(34)
crL = vbNewLine
'If Me.cboOffice.Vi sible = True Then
'txt_ReturnInfo .Value = ? Needs to return the correct office address.
'Else
If Forms![frmMainmenu]!txtOffice = "Cincinnati " Then
txt_ReturnInfo. Value = "company name" & crL _
& "address1" & crL _
& "city1, state1, zip1" & crL _
& "website"
ElseIf Forms![frmMainmenu]!txtOffice = "Cleveland" Then
txt_ReturnInfo. Value = "company name" & crL _
& "address2" & crL _
& "city2, state2, zip2" & crL _
& "website"
ElseIf Forms![frmMainmenu]!txtOffice = "Columbus" Then
txt_ReturnInfo. Value = "company name" & crL _
& "address3" & crL _
& "city3, state3, zip3" & crL _
& "website"
Else
txt_ReturnInfo. Value = ""
End If
'End If
End Sub[/CODE]
Comment