Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update ComboBox Value from TextBox Input

Status
Not open for further replies.

DownwardSix

Technical User
Feb 5, 2003
4
US
I have a ComboBox that selects the current record for a form (Location Name).

I then have an Add Location button that allows user to add a new Location Name which turns off the ComboBox, turns on a TextBox to add the name and a Add Button that turn the TextBox off and the ComboBox Back on. I would like the value in the combo box to update to the new Location when the Add Button is clicked, but it does not, it retains the previous value, even though the the form and sub form update to the new record.

Code on Add Button Click:

Private Sub Add_Button_Click()
On Error GoTo Err_Add_Button_Click

' Set New Record
Dim rs As Object

Set rs = Me.Recordset.Clone

' Turn On & Off Form Features

Me![AddLocation_Button].Visible = True
Me![LocationName].Visible = False
Me![LocationName_Label].Visible = False
Me![Select_LocationName].Visible = True
Me![Select_LocationName_Label].Visible = True
DoCmd.GoToControl "Select_LocationName"

'Set to Record

rs.FindFirst "[LocationID] = " & Str(Nz(Me![Select_LocationName], 0))
'If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Select_LocationName.Requery
Me![Add_Button].Visible = False

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acRefresh, , acMenuVer70

Exit_Add_Button_Click:
Exit Sub

Err_Add_Button_Click:
MsgBox Err.Description
Resume Exit_Add_Button_Click
End Sub

 

Oops hit Submit not Preview... Continued

Can anyone tell me what to add to the code above to get the value displayed in the ComboBox to update.

Thanks,

DownwardSix
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top