combo boxes

  • Thread starter Thread starter john
  • Start date Start date
J

john

ive got a combo box and in order to add new items to the
list im useing an event procedure to call a form to enter
the details, when the form closes im trying to get the
combo box to update ive tried;

Forms!main!combo1.Requery

and ive tried;

me.combo1.requery i dont get any errors but it doent
update either can any one help me here???
 
john said:
ive got a combo box and in order to add new items to the
list im useing an event procedure to call a form to enter
the details, when the form closes im trying to get the
combo box to update ive tried;

Forms!main!combo1.Requery

and ive tried;

me.combo1.requery i dont get any errors but it doent
update either can any one help me here???
John,
This works for me:

DoCmd.OpenForm "frmPay to", , , , , acDialog, "GoToNew"
Me![PayeeID].Requery

Pehaps you have something else going on.
 
ive got a combo box and in order to add new items to the
list im useing an event procedure to call a form to enter
the details, when the form closes im trying to get the
combo box to update ive tried;

Forms!main!combo1.Requery

and ive tried;

me.combo1.requery i dont get any errors but it doent
update either can any one help me here???

Try resetting the RowSource.

Dim strSrce As String

strSrce = Me.combo1.RowSource
Me.combo1.RowSource =""
Me.combo1.RowSource = strSrce


- Jim
 
ive got a combo box and in order to add new items to the
list im useing an event procedure to call a form to enter
the details, when the form closes im trying to get the
combo box to update ive tried;

Forms!main!combo1.Requery

and ive tried;

me.combo1.requery i dont get any errors but it doent
update either can any one help me here???

Try resetting the RowSource.

Dim strSrce As String

strSrce = Me.combo1.RowSource
Me.combo1.RowSource =""
Me.combo1.RowSource = strSrce


- Jim
 
ive got a combo box and in order to add new items to the
list im useing an event procedure to call a form to enter
the details, when the form closes im trying to get the
combo box to update ive tried;

Forms!main!combo1.Requery

and ive tried;

me.combo1.requery i dont get any errors but it doent
update either can any one help me here???

Try resetting the RowSource.

Dim strSrce As String

strSrce = Me.combo1.RowSource
Me.combo1.RowSource =""
Me.combo1.RowSource = strSrce


- Jim
 
John,

Here is an alternate way to add to a combo box without
using an additional form. Change the control/field names
to your usage.

Set the LimitToList to YES.

In the NotInList Event: (Watch for line wrap...)

Private Sub Heading1_NotInList(NewData As String, Response
As Integer)

'Cut/paste from here-----------------------
Dim db As DAO.Database
Dim rst As DAO.Recordset

' Prompt user to verify they wish to add new value.
' all one line
If MsgBox("Do you want to add '" & NewData & "' as a new
title?", vbYesNo) "Add New Item?") = vbYes Then

Set db = CurrentDb
Set rst = db.OpenRecordset("tScopeOfWorkHeaderList")
' the following adds the NewData to the table
With rst
.AddNew ' new record
!Header = NewData
.Update ' save it
End With
' close the recordset and cleanup
rst.Close
Set rst = Nothing
Set db = Nothing

' Continue without displaying default error message.
' This also does an automatic requery ******
Response = acDataErrAdded
Else
' don't add & continue
Response = acDataErrContinue
' clear the combo box
Me.Heading1.Undo
End If
'To here-----------------------
End Sub

HTH

Steve
 
Back
Top