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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update mainform combo boxes based on other forms data entry

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
US
I have 3 combo boxes on my main form
cboContract, cboSubdiv and cboContractID
When a new contract needs to be added, a different form opens for data entry and saving of the data.

All of this works fine. What I am trying to do is refresh or requery the combo boxes on the main form after I save the data on the other forms.

I have tried
cbocontract.requery on the save button of the add form as well as the last steps on the initital button clicked to go to the add form.
I have also tried it on the mainform on open but I cant seem to get the combo boxes to actually refresh with the newly entered data.

On the combo boxes - on click event the code is
Code:
SELECT DISTINCT tblContracts.FldContractNum, tblContracts.fldSubdivisionName, tblContracts.fldContractId, tblContracts.fldContractStatus
FROM tblContracts
WHERE (((tblContracts.fldContractStatus)<>"D"));

I thought that this should automatically display the new information but it doesn't.
Does anyone see why this isn't working?
 
You rally have SQL code as Click event code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Your right. I should have said the sql was my rowsource and the onclick even had me.requery. My mistake :)
 
Instead of Me.Requery, I'd try this in the event procedure:
Code:
Me!cboContract.RowSource = "SELECT DISTINCT FldContractNum,fldSubdivisionName,fldContractId,fldContractStatus" _
 & " FROM tblContracts WHERE fldContractStatus)<>'D'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Great idea. I wil definitely try that although it will be a few days before I can get back to that project. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top