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!

range of check boxes

Status
Not open for further replies.

madvalpreston

Technical User
Apr 7, 2011
142
GB
Hi

we have a quotation form which is all working now. the next stage is we want to when we receive a customer Po do this

1. Have a range of check boxes (perhaps in another form) that have to be ticked (based on a quote number) , for example

Is customer name correct
is customer address correct
Is price correct etc.........

At the end if not all are ticked, I want a message box to come up and tell the user, all boxes must be checked do you want to continue Yes/NO. If Yes go back to the form, if No close the form and dont save the record...

If they are all checked then I want the user to be prompted with
"Do you want to create an order" If yes then I want all the quote details being copied into anothe table called orders which will have an autonumber for orderno...

So could someone help with

1. How to make the code for the check box
2. How to do the code for the create order
3. Also any advice how to populate the order table with the relevant data from quote table.

many thanks
 
How are ya madvalpreston . . .

Here's an Idea of validating the checkboxes and transfering quote data. Note ... in the [blue]Tag[/blue] property of the checkboxes enter the [purple]@[/purple] character:
Code:
[blue]Private Sub Form_BeforeUpdate(Cancel As Integer)
   Dim ctl As Control
   
   flgXfer = False
   
   For Each ctl In Me.Controls
      If ctl.Tag = "[purple][b]@[/b][/purple]" Then
         If ctl = False Then
            If MsgBox("All boxes must be checked do you want to continue?", _
                     vbQuestion + vbYesNo, _
                     "Validation Error Detected!") = vbYes Then
               Cancel = True
               Exit Sub
            Else
               Cancel = True
               Me.Undo
               Me.Undo
               DoCmd.Close acForm, "[purple][B][I]YourFormName[/I][/B][/purple]", acSaveNo
               Exit Sub
            End If
         End If
      End If
   Next
         
   If MsgBox("Do you want to create an order?", _
             vbQuestion + vbYesNo, _
             "Create Order? . . .") = vbYes Then
      flgXfer = True [green]'Signals AfterUpdate event to perform data transfer.[/green]
   Else
      Cancel = True
   End If

End Sub

Private Sub Form_AfterUpdate()
   Dim db As DAO.Database, SQL As String
   
   If flgXfer Then
      Set db = CurrentDb
      
      SQL = "[purple][B][I]Your Insert SQL Here![/I][/B][/purple]"
      db.Execute SQL, dbFailOnError

      Set db = Nothing
   End If
   
End Sub[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [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