By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,702 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,702 IT Pros & Developers. It's quick & easy.

Combo Box to Change Preset Textbox

100+
P: 114
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!
Expand|Select|Wrap|Line Numbers
  1. Private Sub returnDefault(returnType)
  2. '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)
  3.     Dim crQ As String
  4.     Dim crL As String
  5.     crQ = Chr$(34)
  6.     crL = vbNewLine
  7.  
  8.   'If Me.cboOffice.Visible = True Then
  9.     'txt_ReturnInfo.Value = ?  Needs to return the correct office address.
  10.  
  11.   'Else
  12.     If Forms![frmMainmenu]!txtOffice = "Cincinnati" Then
  13.     txt_ReturnInfo.Value = "company name" & crL _
  14.                             & "address1" & crL _
  15.                             & "city1, state1, zip1" & crL _
  16.                             & "website"
  17.     ElseIf Forms![frmMainmenu]!txtOffice = "Cleveland" Then
  18.     txt_ReturnInfo.Value = "company name" & crL _
  19.                             & "address2" & crL _
  20.                             & "city2, state2, zip2" & crL _
  21.                             & "website"
  22.     ElseIf Forms![frmMainmenu]!txtOffice = "Columbus" Then
  23.     txt_ReturnInfo.Value = "company name" & crL _
  24.                             & "address3" & crL _
  25.                             & "city3, state3, zip3" & crL _
  26.                             & "website"
  27.     Else
  28.     txt_ReturnInfo.Value = ""
  29.     End If
  30. 'End If
  31.  End Sub
Feb 14 '08 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 446
Hi
I started to write on this a while ago then 'lost' what I wrote so hope this is not coming through twice.

The bottom line is that you seem to be setting some address data via hard-coding then hoping to change it via the form which is using the hard coding.

Can't be done! That's what tables are for.

Put your address details in a small table then bind you form to that table or look-up then paint the screen or whatever.

I see you have a hundred or so posts so must have a bit of a clue how to do this? Let's know if you get stuck.

S7
Feb 20 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.