Hi Every one,
I have a problem with a DB I'm building, I've got it all finisherd except the front form. What I'm trying to do is populate a grid of 9 rows by 14 colums with either arrival dates or departure dates, these dates are in a qryDailyBooking s.
The 9 row are txtboxes names Room1 thu Room9 they are unbound.
The 14 colums are txtboxes named Date1 thru Date14 and have a controlsource of :
which works to change the entered departure date to red so you can tell them apart.
Hope you can understand this and can help.
Thanks itchysf
I have a problem with a DB I'm building, I've got it all finisherd except the front form. What I'm trying to do is populate a grid of 9 rows by 14 colums with either arrival dates or departure dates, these dates are in a qryDailyBooking s.
The 9 row are txtboxes names Room1 thu Room9 they are unbound.
The 14 colums are txtboxes named Date1 thru Date14 and have a controlsource of :
Code:
(code***)
=DateAdd("d",0-14,[Startdate]),
(code/)
[Startdate] being an unbound txtbox with an popup calander for users to select a date from.
The grid is made up (about half so far) with onbound txtboxes. What I have done so far is put the Iff expression:
(code***)
(=IIf([Room1]=[RoomNumber] And [Date2]=[ArrivalDate],[ArrivalDate],IIf([Room1]=[RoomNumber] And [Date2]=[DepartureDate],[DepartureDate],Null)))
(code/)
in the controlsource of these txtboxes, but as you can see this is not very good, as you have to click through all records to get a result.
What I'm asking is there anyway to use VBA to loop through the records of ArrivalDates and DepartureDates to populate the grid all at once when a date is picked with out clicking thru the records one at a time.
I've also got VBA loop:
(code***)
Private Sub Form_Current()
On Error Resume Next
For Each c In Me.Controls
If InStr(1, c.Name, "Text") <> 0 Then
If c.Value = DepartureDate.Value Then
c.ForeColor = vbRed
Else
c.ForeColor = vbBlack
End If
End If
Next
On Error GoTo 0
End Sub
(code/)
Hope you can understand this and can help.
Thanks itchysf
Comment