Combo not requerying

davesmith202

Employee of Access World
Local time
Today, 08:00
Joined
Jul 20, 2001
Messages
522
My Form frmAdwordsMain has a command button which when clicked pops up frmProducts. When I click Close on frmProducts, the idea is to update the value in a combo box on frmAdwordsMain.

This value comes from tblProducts. But when I click the Close button on frmProducts, does this mean that it hasn't actually stored the new entry into tblProducts and therefore can't show this value in the combo box on frmAdwordsMain yet?

I hope this makes sense!

If this is the case, how can I get around this?

Dave
 
use the comboboxname.requery to refresh the combo box. you may want to consider a later even after the product has been added to your table. but the most important part is to requery the combo box.
good luck,
sam
 
My code is below so you can see I have requeries the combo box. But it is still not working. So is it because of the reason I said in my original post?

Code:
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
    
    Forms![frmAdwordsMain]!Adgroup.Requery
    
    If IsNull(Forms!frmAdwordsMain!Campaign) = True Then
        Forms!frmAdwordsMain!Campaign = CategoryID
        strBuildAdgroupString = [CategoryID] & " > " & [Product] & " > " & [SubProduct] & ": " & [SubProduct]
        Forms!frmAdwordsMain!Adgroup = strBuildAdgroupString     
        End If
    DoCmd.Close
    Run Forms![frmAdwordsMain].Adgroup_AfterUpdate()

Exit_cmdClose_Click:
    Exit Sub

Err_cmdClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdClose_Click
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom