Below is an example of the code I am working with. This code changes the BackColor of lables on a form. This code works just, except I would like for it to "pause" while the user enters a small bit of data into 1 table/1 field. I have a query that deletes the previously entered data, and then the table opens to enter new data (just 1 field only). This is working just great up to this point.
I would like the user to be able to close the table (after the new data is entered), and then return back to the form, and the code would continue from there. I sure hope this makes sense!!
Private Sub Box321_Click()
Dim rstNewAllocations As New ADODB.Recordset
Dim ctl As Control
Dim i As Integer
DoCmd.OpenQuery "qryDeleteNewAllocations" 'Deletes previously entered GTWYs.
DoCmd.OpenTable "NewAllocations" 'Opens table to add new GTWYs
' Open a recordset based on the WWReviewhelper query.
rstNewAllocations.Open "qryNewAllocations", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
' If no GTWYs overallocated.
If rstNewAllocations.RecordCount = 0 Then
MsgBox "There are NEW GTWYs selected to be allocated this part."
End If
If rstNewAllocations.EOF Then
Exit Sub
End If
'loop through form controls
For Each ctrl In Me.Controls
If TypeOf ctrl Is Label Then
With rstNewAllocations
.MoveFirst
For i = 1 To .RecordCount
If ctrl.Caption = !GTWY Then
ctrl.BackColor = 13434828
End If
.MoveNext
Next i
End With
End If
Next
End Sub
I would like the user to be able to close the table (after the new data is entered), and then return back to the form, and the code would continue from there. I sure hope this makes sense!!
Private Sub Box321_Click()
Dim rstNewAllocations As New ADODB.Recordset
Dim ctl As Control
Dim i As Integer
DoCmd.OpenQuery "qryDeleteNewAllocations" 'Deletes previously entered GTWYs.
DoCmd.OpenTable "NewAllocations" 'Opens table to add new GTWYs
' Open a recordset based on the WWReviewhelper query.
rstNewAllocations.Open "qryNewAllocations", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
' If no GTWYs overallocated.
If rstNewAllocations.RecordCount = 0 Then
MsgBox "There are NEW GTWYs selected to be allocated this part."
End If
If rstNewAllocations.EOF Then
Exit Sub
End If
'loop through form controls
For Each ctrl In Me.Controls
If TypeOf ctrl Is Label Then
With rstNewAllocations
.MoveFirst
For i = 1 To .RecordCount
If ctrl.Caption = !GTWY Then
ctrl.BackColor = 13434828
End If
.MoveNext
Next i
End With
End If
Next
End Sub