D
Dickie Black
Hi,
I'd like to set the caption for a group of labels on an unbound form
depending on the presence of a record in a table. That is, if a record
exists for Monday 12th July at 9:30 AM I would like for a box to show one of
the fields from that record.
I have tried the following:
'create recordset for week described in week commencing combo
Dim rs As DAO.Recordset
Dim SQLString As String
SQLString = "SELECT * FROM [Session] WHERE ((([Session].[Date]) Between " &
DateMon & " AND " & DateFri & "));"
Set rs = CurrentDb.OpenRecordset(SQLString)
'set values for boxes to relevant record
rs.FindFirst ("[Date] = DateMon And [StartTime] = Session1")
Me.Session_1_1.Caption = [Title]
'close recordset
Set rs = Nothing
where the values for Session1, DateMon and DateFri are set earlier in the
code.
I know the line Me.Session_1_1.Caption = [Title] does not work, but think it
gives an impression of what I'm trying to achieve. I want to find a record
that occurs at the time and date specified then set the caption of the label
to the value of the [Title] field. Am I going about this correctly?
TIA,
Dickie Black
I'd like to set the caption for a group of labels on an unbound form
depending on the presence of a record in a table. That is, if a record
exists for Monday 12th July at 9:30 AM I would like for a box to show one of
the fields from that record.
I have tried the following:
'create recordset for week described in week commencing combo
Dim rs As DAO.Recordset
Dim SQLString As String
SQLString = "SELECT * FROM [Session] WHERE ((([Session].[Date]) Between " &
DateMon & " AND " & DateFri & "));"
Set rs = CurrentDb.OpenRecordset(SQLString)
'set values for boxes to relevant record
rs.FindFirst ("[Date] = DateMon And [StartTime] = Session1")
Me.Session_1_1.Caption = [Title]
'close recordset
Set rs = Nothing
where the values for Session1, DateMon and DateFri are set earlier in the
code.
I know the line Me.Session_1_1.Caption = [Title] does not work, but think it
gives an impression of what I'm trying to achieve. I want to find a record
that occurs at the time and date specified then set the caption of the label
to the value of the [Title] field. Am I going about this correctly?
TIA,
Dickie Black