Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("TableOrQueryNameHere")
Do Until rst.EOF
' do something here
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Is there any way i can makes this or get something similar to look thoguh forms data ??? not tbl or query i would like it to adapt to this code...
Private Sub Command17_Click()
Dim rst As DAO.Recordset
Dim strAdrs As String
Dim strBody As String
Dim strSQL As String
Set rst = CurrentDb.OpenRecordset("qrynofollowuptraining")
strSQL = "SELECT [Text] FROM tblEditLetters WHERE [Title] = 'FUA'"
rst.MoveFirst
Do Until rst.EOF
strAdrs = strAdrs & Forms!frmNoFollowUptraining.ClientEmail & " :"
rst.MoveNext
Loop
strAdrs = Left(strAdrs, Len(strAdrs) - 1)
Debug.Print strAdrs
Set rst = CurrentDb.OpenRecordset(strSQL, dbOpenSnapshot)
If Not (rst.BOF And rst.EOF) Then
DoCmd.SendObject , , , Me.ClientEmail, , , "[BDS]we haven't herd from you in a while", rst![Text]
If (Err <> 0) Then MsgBox "Error " & Err.Number & vbCrLf & Err.Description
End If
End Sub
so it only grabs the email addresses on the current form not the TBL client detials :D that simple right? i hope :P
R.King the best DB noob