Option Compare Database
Option Explicit
Public Sub fRSL_DefaultValueInsert()
On Error GoTo Error_Handler
Dim curDB As DAO.Database
Dim rsAwarded As DAO.Recordset
Set curDB = CurrentDb
Dim strSQL_RSL As String
strSQL_RSL = "SELECT ShortTitle, ProjectTitle, Funder, Scheme, DPAGInvestigator, X5reference, FunderType FROM tblApplications WHERE (((Awarded)=True));"
Set rsAwarded = curDB.OpenRecordset(strSQL_RSL, dbOpenForwardOnly)
Do Until rsAwarded.EOF
Dim strFrmName As String
strFrmName = "frmAward"
DoCmd.OpenForm strFrmName, , , , acFormAdd
With Forms(strFrmName)
.txtShortTitle.DefaultValue = Chr(34) & rsAwarded!ShortTitle & Chr(34)
.txtProjectTitle.DefaultValue = Chr(34) & rsAwarded!ProjectTitle & Chr(34)
.txtFunder.DefaultValue = Chr(34) & rsAwarded!Funder & Chr(34)
.txtScheme.DefaultValue = Chr(34) & rsAwarded!Scheme & Chr(34)
.txtDPAGPI.DefaultValue = Chr(34) & rsAwarded!DPAGInvestigator & Chr(34)
.txtX5reference.DefaultValue = Chr(34) & rsAwarded!X5reference & Chr(34)
.txtFunderType.DefaultValue = Chr(34) & rsAwarded!FunderType & Chr(34)
.txtExtraFld3.DefaultValue = Chr(34) & "Default Value Method" & Chr(34)
End With
rsAwarded.MoveNext
Loop
Exit_ErrorHandler:
rsAwarded.Close
Set rsAwarded = Nothing
Set curDB = Nothing
Exit Sub
Error_Handler:
MsgBox "Error From --- basAgeRangeCount, fRSL_DefaultValueInsert --- Error Number >>> " _
& Err.Number & " <<< Error Description >> " & Err.Description, , "Your Application Name"
Resume Exit_ErrorHandler
End Sub