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

Continuous Forms

Status
Not open for further replies.

Chicagodude

Programmer
Nov 18, 2008
11
US
I have a Continuous Forms. It has three text box. First text box display data from table column called nominal value. Second text box where user enter result value and last text box is message label. I have a conditional formating where user enter vlaue for second text box and it is higher then text box 1 then set the back color for third textbox to "Red" from default color white.

I want a do two thinks.
1) If user hit save button and one of the second text box out in Continuous Forms is blank then give them error message. (Example if Continuous Forms has 5 recond and user enter result value for only 4 then give them message stating Result value can not be blank or display which row or nominal has blank result value.

2) If user enter value for all 5 result text box on Continuous Forms and one of them has higher value then nominal (which will change the back color for third textbox to "RED") then give them message saying one of the result value is higher then nominal please contact supervision.

How can i achive these two task.
 
How are ya Chicagodude . . .

Try the following ([green]answering #1 in your post[/green]) in the [blue]click event[/blue] of the button:
Code:
[blue]   Dim rst As DAO.Recordset
   Dim Msg As String, Style As Integer, Title As String, DL As String
   
   DL = vbNewLine & vbNewLine [green]'double line skip[/green]
   If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord [green]'save if edited![/green]
   Set rst = Me.RecordsetClone
   
   If rst.BOF Then
      Msg = "No Records to Check!"
      Style = vbInformation + vbOKOnly
      Title = "Can't Check Notice! . . ."
      MsgBox Msg, Style, Title
   Else
      Do Until rst.EOF
         If Trim(rst![Result] & "") = "" Then
            Msg = "Result Value Can't be Blank!" & DL & _
                  "Delete the record or enter a 'Result' Value!"
            Style = vbInformation + vbOKOnly
            Title = "Blank 'Result' Detected!"
            MsgBox Msg, Style, Title
            Me.Bookmark = rst.Bookmark
            Me![Result].SetFocus
            Exit Sub '[green]exit to modify[/green]
         End If
      Loop
   End If
   
   Set rst = Nothing[/blue]
[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top