Originally Posted by
June7
Well, Requery won't work because frmPDMonitor has unbound controls. Your code is populating unbound controls, not displaying records. Would need code to set controls back to null.
The form has 20 sets of unbound controls. This means limited to 20 sets of data.
Why is this not just one set of controls bound to fields?
Thanks again June 7,
Here is the code I used to populate the controls:
Code:
Public Sub LoadMyForm(frm As Access.Form)
On Error GoTo Error_Handler
' Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim x As Integer
' Set db = CurrentDb()
Set rs = db.OpenRecordset("qryPDMonitor", dbOpenSnapshot)
For x = 1 To 16
If rs.EOF Then Exit For
With frm
frm.Controls("qn" & x) = rs!QuoteLogNumber
frm.Controls("cust" & x) = rs!Customer
frm.Controls("sales" & x) = rs![Sales COOrd]
frm.Controls("prod" & x) = rs!ProductDesignInitials
frm.Controls("submit" & x) = rs!dtmTimeSubmitted
frm.Controls("total" & x) = rs!Expr1
frm.Controls("c" & x) = rs!PartsCompleted
frm.Controls("e" & x) = rs!ynExpedite
End With
rs.MoveNext
Next
Error_Handler_Exit:
On Error Resume Next
rs.Close
Set rs = Nothing
' Set db = Nothing
Exit Sub
Error_Handler:
MsgBox "The following error has occured." & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: LoadMyForm" & vbCrLf & _
"Error Description: " & Err.Description, _
vbCritical, "An Error has Occured!"
Resume Error_Handler_Exit
End Sub
This code is called from a Timer Event on my forms Load Event.
Like I said I'm still learning. Could you take a look at the code and suggest a solution that de-populates the controls?