Does not work. How do I get it to appear on the bottom of the form? That is probebly the biggest problem that I have.
--- In [email protected], Dennis Jensen <[EMAIL PROTECTED]> wrote: > > First your not using the "field" on the form because > you declared it as a local variable. Second while your > code almost works you are declaring several > unnecessary variables. Try this... > > Private Sub Form_AfterUpdate() > 'Cost of procedures on animal intake form. > Dim sngTotal As Single > On Error Goto ErrorHandler > 'Input amounts from boxes checked True on > 'the Intake Form and calculate the total. > sngTotal = 0 > If (Rabies = True) Then > sngTotal = sngTotal + 12 > End if > If (Nail = True) Then > sngTotal = sngTotal + 2 > End if > If (Sterlization = True) Then > sngTotal = sngTotal + 63 > End if > 'Note -- assuming a normal textbox for output > FieldName.Text = Format(sngTotal, "$##0.00") > Exit Sub > ' > ErrorHandler: > ' Call LogError(Err.Description & " [" & Err.Number > & "] frmFormName.Form_AfterUpdate") > End Sub > > You'll note that I added a error handling routine this > should be nearly standard practice in your code for > ease of tracking down errors and such but then again > its your call. You would have to define LogError and > it could be as simple as popping a message box but I > find it works best if you dump the error out to a text > file and pop a generic message telling the user to > contact the Help Desk. > > However if you just want a quick fix for what you > have... just add this to your code after the > totalling. > > frmFormName.FieldName.Text = Format(sngTotal, > "$##0.00") > > Good Luck > --Dennis > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AccessVBACentral/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
