G
Guest
Is there a way to append a variable number (from a loop) to a [abcd] field?
Ex:
for x =1 tp 10
If DLookup("[x]", "table1", "[ID]=x") = False Then
[datax]=false
endif
next x
I would like all the "x" in this code to take the value of the loop.
I'm trying to make a camping ground reservation database. I've setup a table
where each column represents a lot and each row a date. Each lot field is
either true (free) or false (taken) for the corresponding date.
I intend to make a form with the basic layout of the camping ground with
each cells changing color according to the status for the asked dates.
So, if say someone wants to stay from the 6 to the 15, I have to loop
through those numbers and through all the lot numbers to find all the lots
available for this period.
The "real code" would look like something like this, where the looping
numbers are "dt" and "lot_no".
"lot" is the name of the cell in the form, actually named "lot1, lot2, lot3"
that will change color so I need to append the "lot_no" to "lot". Am I making
any sense here?
Of course, this particular code doesn't work.
For dt = [Date_in] To [Date_out]
For lot_no = 1 To 100
If DLookup("[dt]", "reservation", "[ID]=lot_no") = False Then
[lot lot_no].BackColor = 255
Else: [lot lot_no].BackColor = 65280
End If
Next lot_no
Next dt
thanks.
Pierre.
Ex:
for x =1 tp 10
If DLookup("[x]", "table1", "[ID]=x") = False Then
[datax]=false
endif
next x
I would like all the "x" in this code to take the value of the loop.
I'm trying to make a camping ground reservation database. I've setup a table
where each column represents a lot and each row a date. Each lot field is
either true (free) or false (taken) for the corresponding date.
I intend to make a form with the basic layout of the camping ground with
each cells changing color according to the status for the asked dates.
So, if say someone wants to stay from the 6 to the 15, I have to loop
through those numbers and through all the lot numbers to find all the lots
available for this period.
The "real code" would look like something like this, where the looping
numbers are "dt" and "lot_no".
"lot" is the name of the cell in the form, actually named "lot1, lot2, lot3"
that will change color so I need to append the "lot_no" to "lot". Am I making
any sense here?
Of course, this particular code doesn't work.
For dt = [Date_in] To [Date_out]
For lot_no = 1 To 100
If DLookup("[dt]", "reservation", "[ID]=lot_no") = False Then
[lot lot_no].BackColor = 255
Else: [lot lot_no].BackColor = 65280
End If
Next lot_no
Next dt
thanks.
Pierre.