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!

Inhereted bad vb code... please assist 1

Status
Not open for further replies.
Dec 5, 2005
40
US
This is the problem area that is being highlighted by the debugger, this is a MS Access 2003 DB.



txtCurrRent = Me.MktRent - forms_frm_MoveInDECredit!txt30Percent - forms_frm_MoveInDECredit!Gas - forms_frm_MoveInDECredit![W/S] - forms_frm_MoveInDECredit![Electric] - forms_frm_MoveInDECredit![Refuse]




Can you help me identify the problem.

Entire Section of Code
Private Sub txtMktRent_Exit(Cancel As Integer)
If cmbSpecType = "Spread" Then
CurrRent = Round(MktRent * 11 / 12)
txtRentCred.Visible = True
End If
If frm_MoveInDECredit.Visible = True Then
'Me.Refresh
Me.Recalc
Me.txtCurrRent.Enabled = True
txtCurrRent = Me.MktRent - forms_frm_MoveInDECredit!txt30Percent - forms_frm_MoveInDECredit!Gas - forms_frm_MoveInDECredit![W/S] - forms_frm_MoveInDECredit![Electric] - forms_frm_MoveInDECredit![Refuse]
Me.txtCurrRent.Enabled = False
Me.frm_MoveInDECredit.SetFocus
Else
Me.frm_MoveInDECredit.Visible = False
Me.txtCurrRent.Enabled = True
Me.txtCurrRent.SetFocus
End If
End Sub
 
Any error message ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yeah, an actual error message/code would help. [wink]

Until you can post back with that, I've got a few guesses for starters - not saying they are necessarily true, but it seems possible to me:

[OL]
[LI]A math problem - If it worked before, but suddenly not now, make sure the math actually works out. It may be that you need to work that into the code as well, so it'll give an error message if it comes out as not being a legitimate result.[/LI]
[LI]Perhaps it would work better if you had:
forms!frm_MoveInDECredit!txt30Percent
Instead of:
forms_frm_MoveInDECredit!txt30Percent[/LI]
[LI]Did any of the field names change since the code was created? Did you change any field names on the form?[/LI]
[/OL]

--

"If to err is human, then I must be some kind of human!" -Me
 
For starters, I would surround each call to a control with Nz in case one of them is Null, e.g.

Nz(Me.MktRent,0)



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top