Combo Box update

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Ok I swear I've read and tried previous posts on this topic but I'm still
stumped.
It should be simple but...

I have a form based on a query: [ReportingQuery]. Within this form I have
a cobo box with a rowsource based on a another query [Qry_RefSourceMain] as
follows:

SELECT Qry_RefSourceMain.RefID, Qry_RefSourceMain.[Combined Contact] FROM
Qry_RefSourceMain ORDER BY Qry_RefSourceMain.[Combined Contact];

If the "[Combined Contact]" does not appear on the drop-down, the user
clicks on a button which opens a pop-up form to add entries to the table
underlying the [Qry_RefSourceMain] query.

MY PROBLEM -- after closing this pop-up form, the combo box is not updated
with the new entry. I've tries docmd.requery everywhere I can think to put
it with no success. Unfortunetly, this is the extent of my coding skills. I
saw some similiar issues in other postes but was unable to adapt the code to
my form. Closing as reopening the form works but is obviously not the ideal
solution. This is driving me nuts so any help would be greatly appreciated.
 
Post the code steps from the procedures that you're using.... the problem
could be one of many possible ones...
 
I'm sorry Ken if I'm misunderstanding but I don't think I'm using any code at
the moment. I'm just trying come with some code to update that field.

The other code that I tried to adapt didn't work so I deleted it. One
additional thing I noted; the Refresh command under the RECORDS menue updates
the field. Is there a way to execute this command from the On Focus event of
my main form? That might do it.

Ken Snell said:
Post the code steps from the procedures that you're using.... the problem
could be one of many possible ones...

--

Ken Snell
<MS ACCESS MVP>

Bdavis said:
Ok I swear I've read and tried previous posts on this topic but I'm still
stumped.
It should be simple but...

I have a form based on a query: [ReportingQuery]. Within this form I
have
a cobo box with a rowsource based on a another query [Qry_RefSourceMain]
as
follows:

SELECT Qry_RefSourceMain.RefID, Qry_RefSourceMain.[Combined Contact] FROM
Qry_RefSourceMain ORDER BY Qry_RefSourceMain.[Combined Contact];

If the "[Combined Contact]" does not appear on the drop-down, the user
clicks on a button which opens a pop-up form to add entries to the table
underlying the [Qry_RefSourceMain] query.

MY PROBLEM -- after closing this pop-up form, the combo box is not updated
with the new entry. I've tries docmd.requery everywhere I can think to
put
it with no success. Unfortunetly, this is the extent of my coding skills.
I
saw some similiar issues in other postes but was unable to adapt the code
to
my form. Closing as reopening the form works but is obviously not the
ideal
solution. This is driving me nuts so any help would be greatly
appreciated.
 
How is the button opening the form for the entry of the "new" value? VBA
code? macro? That is what I am asking to see.

--

Ken Snell
<MS ACCESS MVP>

Bdavis said:
I'm sorry Ken if I'm misunderstanding but I don't think I'm using any code
at
the moment. I'm just trying come with some code to update that field.

The other code that I tried to adapt didn't work so I deleted it. One
additional thing I noted; the Refresh command under the RECORDS menue
updates
the field. Is there a way to execute this command from the On Focus event
of
my main form? That might do it.

Ken Snell said:
Post the code steps from the procedures that you're using.... the problem
could be one of many possible ones...

--

Ken Snell
<MS ACCESS MVP>

Bdavis said:
Ok I swear I've read and tried previous posts on this topic but I'm
still
stumped.
It should be simple but...

I have a form based on a query: [ReportingQuery]. Within this form I
have
a cobo box with a rowsource based on a another query
[Qry_RefSourceMain]
as
follows:

SELECT Qry_RefSourceMain.RefID, Qry_RefSourceMain.[Combined Contact]
FROM
Qry_RefSourceMain ORDER BY Qry_RefSourceMain.[Combined Contact];

If the "[Combined Contact]" does not appear on the drop-down, the user
clicks on a button which opens a pop-up form to add entries to the
table
underlying the [Qry_RefSourceMain] query.

MY PROBLEM -- after closing this pop-up form, the combo box is not
updated
with the new entry. I've tries docmd.requery everywhere I can think to
put
it with no success. Unfortunetly, this is the extent of my coding
skills.
I
saw some similiar issues in other postes but was unable to adapt the
code
to
my form. Closing as reopening the form works but is obviously not the
ideal
solution. This is driving me nuts so any help would be greatly
appreciated.
 
Got it.... sorry. It's code behind a button. I just used the button wizard:

Private Sub Command309_Click()
On Error GoTo Err_Command309_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_AddRefSource"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command309_Click:
Exit Sub

Err_Command309_Click:
MsgBox Err.Description
Resume Exit_Command309_Click

End Sub

Ken Snell said:
How is the button opening the form for the entry of the "new" value? VBA
code? macro? That is what I am asking to see.

--

Ken Snell
<MS ACCESS MVP>

Bdavis said:
I'm sorry Ken if I'm misunderstanding but I don't think I'm using any code
at
the moment. I'm just trying come with some code to update that field.

The other code that I tried to adapt didn't work so I deleted it. One
additional thing I noted; the Refresh command under the RECORDS menue
updates
the field. Is there a way to execute this command from the On Focus event
of
my main form? That might do it.

Ken Snell said:
Post the code steps from the procedures that you're using.... the problem
could be one of many possible ones...

--

Ken Snell
<MS ACCESS MVP>

Ok I swear I've read and tried previous posts on this topic but I'm
still
stumped.
It should be simple but...

I have a form based on a query: [ReportingQuery]. Within this form I
have
a cobo box with a rowsource based on a another query
[Qry_RefSourceMain]
as
follows:

SELECT Qry_RefSourceMain.RefID, Qry_RefSourceMain.[Combined Contact]
FROM
Qry_RefSourceMain ORDER BY Qry_RefSourceMain.[Combined Contact];

If the "[Combined Contact]" does not appear on the drop-down, the user
clicks on a button which opens a pop-up form to add entries to the
table
underlying the [Qry_RefSourceMain] query.

MY PROBLEM -- after closing this pop-up form, the combo box is not
updated
with the new entry. I've tries docmd.requery everywhere I can think to
put
it with no success. Unfortunetly, this is the extent of my coding
skills.
I
saw some similiar issues in other postes but was unable to adapt the
code
to
my form. Closing as reopening the form works but is obviously not the
ideal
solution. This is driving me nuts so any help would be greatly
appreciated.
 
You can requery the combo box after the form is opened in Dialog mode and
used:

Private Sub Command309_Click()
On Error GoTo Err_Command309_Click

Dim stDocName As String

stDocName = "frm_AddRefSource"
DoCmd.OpenForm stDocName, , , , , acDialog

Me.ComboBoxName.Requery

Exit_Command309_Click:
Exit Sub

Err_Command309_Click:
MsgBox Err.Description
Resume Exit_Command309_Click

End Sub

--

Ken Snell
<MS ACCESS MVP>


Bdavis said:
Got it.... sorry. It's code behind a button. I just used the button
wizard:

Private Sub Command309_Click()
On Error GoTo Err_Command309_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frm_AddRefSource"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command309_Click:
Exit Sub

Err_Command309_Click:
MsgBox Err.Description
Resume Exit_Command309_Click

End Sub

Ken Snell said:
How is the button opening the form for the entry of the "new" value? VBA
code? macro? That is what I am asking to see.

--

Ken Snell
<MS ACCESS MVP>

Bdavis said:
I'm sorry Ken if I'm misunderstanding but I don't think I'm using any
code
at
the moment. I'm just trying come with some code to update that field.

The other code that I tried to adapt didn't work so I deleted it. One
additional thing I noted; the Refresh command under the RECORDS menue
updates
the field. Is there a way to execute this command from the On Focus
event
of
my main form? That might do it.

:

Post the code steps from the procedures that you're using.... the
problem
could be one of many possible ones...

--

Ken Snell
<MS ACCESS MVP>

Ok I swear I've read and tried previous posts on this topic but I'm
still
stumped.
It should be simple but...

I have a form based on a query: [ReportingQuery]. Within this form
I
have
a cobo box with a rowsource based on a another query
[Qry_RefSourceMain]
as
follows:

SELECT Qry_RefSourceMain.RefID, Qry_RefSourceMain.[Combined Contact]
FROM
Qry_RefSourceMain ORDER BY Qry_RefSourceMain.[Combined Contact];

If the "[Combined Contact]" does not appear on the drop-down, the
user
clicks on a button which opens a pop-up form to add entries to the
table
underlying the [Qry_RefSourceMain] query.

MY PROBLEM -- after closing this pop-up form, the combo box is not
updated
with the new entry. I've tries docmd.requery everywhere I can think
to
put
it with no success. Unfortunetly, this is the extent of my coding
skills.
I
saw some similiar issues in other postes but was unable to adapt the
code
to
my form. Closing as reopening the form works but is obviously not
the
ideal
solution. This is driving me nuts so any help would be greatly
appreciated.
 
Back
Top