I'm creating a template MDB for a number of upcoming projects. My current issue is to make my forms more dynamic, in that I will allow the user fill in the name of the form's title and subtitle labels.
TBL name is:
tblInfoFrmTitles
strFrmName
strFrmTitle
strFrmSubTitle
I missing how to pull the data from my recordset for postions 0, 1, and 2.
Ideas appreciated
Even if =DLookUp turns out to be the eaiser approach I would still like to know how to do the above for a future components.
TBL name is:
tblInfoFrmTitles
strFrmName
strFrmTitle
strFrmSubTitle
Code:
Dim strSql As String
Dim strCurFrmName As String
Dim rs As Recordset
Dim db As Database
strCurFrmName = Me.Form.Name
Set db = CurrentDb()
strSql = "SELECT * FROM tblInfoFrmTitles "
strSql = strSql & "WHERE strFrmName = "
strSql = strSql & "strCurFrmName;"
I missing how to pull the data from my recordset for postions 0, 1, and 2.
Code:
Set rs = db.OpenRecordset(strSql, dbOpenSnapshot)
strFrmName = Nz(rs!strCurFrmName, 0)
strFrmTitle = Nz(rs!strCurFrmName, 1)
strFrmSubTitle = Nz(rs!strCurFrmName, 2)
MsgBox strFrmName & " " & strFrmTitle & " " & strFrmSubTitle
Ideas appreciated
Even if =DLookUp turns out to be the eaiser approach I would still like to know how to do the above for a future components.