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

Update table field from IIF statement

Status
Not open for further replies.

end922

Technical User
Apr 17, 2007
59
US
Greetings,
I have a text box on a form that its value is populated from an IIF statement. That value is not being stored in a table. I am now trying to store that value in the tblRepurchase table. I have added the field to the table called Status. The text box on the form is called txtstatus. The form does not have a save button as the user types it saves directly to the table. the only button on the form is search.
So my problem is how can i get txtstatus to write to the field status in the table?
Your assistance is greatly appreciated!
Thanks
 
Bind the text box to the field and set its value in the BeforeUpdate event procedure of the form (using the same logic as the IIf).

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks. I bound the text box to the able and did the following on the form before update. Now the status box does not populate.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.txtStage.Value = IIf([InvestorID] = "EMC" And [ResolutionDt] Is Null, "Prepared for Counsel", IIf([ResolutionDt] Is Not Null, "Closed", IIf([AnalysisExecAgreement] = "Agree", "Pending Resolution", IIf([AnalysisMgrAgreement] = "Agree", "Exec Review", IIf([AnalysisComplDt] Is Not Null, "Manager Review", IIf([AnalysisAnalystAssignedDt] Is Not Null, "In Review", IIf([DemandRecvdDt] Is Not Null, "Notice Received", Null)))))))
End Sub
 
Replace all [field name] with their corresponding Me![control name]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top