Re: how to show two rows in an unbound continuous form
- From: Access infant <Accessinfant@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 26 Dec 2009 05:56:01 -0800
Marsh,
Thanks a lot for your prompt response.Actually i thought of using crosstab
query but i don't know how to bind it. you showed me a way. I have tried what
you have suggested here but find some more obstacles.
First of all, I could not set all the ColumnHeadings before hand. That is
beyond a hundred. So, I cannot consider that possibility.
I have created a crosstab query on the table i gave you earlier.The first
problem is whether i should use SUM, AVG,COUNT in the TOTAL row of the query
design grid. i chose Sum of course but i need your advice here
Another problem is:
To test how it is working,I have first manually bound the checkbox
controlsource to the three allowances fields apart from the leave period(I
have bound the form's controlsource also,of course). Still it displayed only
one row i.e the first leave period 01-01-2008 to 28-02-2008 but the secondrow
for the leave period 01-05-2009 to 31-05-2009 is not displayed in the form.
But everything is perfect in the query datasheet view.could you please tell
me why it is happening so?
The third problem is with the syntax of the following code
Public Function unboundcontinuous()
Dim rst As DAO.Recordset
Dim n As Integer, i As Integer
Set rst = CurrentDb.OpenRecordset("MyCrosstabQuery")
For i = 0 To rst.Fields.Count - 1
n = i + 1
Forms![Form1].[Label & n].Caption = rst!Fields(i).Name
Forms.Form1.("Label" & n).Visible = True
Forms("Form1").Controls("check" & n).Visible = True
Forms("Form1").Controls("check" & n).Caption = rst!Fields(i).Name
rst.MoveNext
Next
Set rst = Nothing
End Function
when i am trying to change the controlsource and caption properties, it is
showing Run-time error 3265 : Item not found in this collection.Probably i
don't kknow the correct syntax to reference the properties.I have given the
different syntaxes i have tried in each line. This 'Access Infant' surely
needs your help to avoid tripping and falling. I eagerly wait your support.
Thanks in advance
--
from
chanakya
Baruva
--
from
chanakya
Baruva
"Marshall Barton" wrote:
Access infant wrote:.
I have table that lists all the allowances an employee draws.It also gives
which of them an employee draws during a leave period.
EmpID Leave period Allowance status
1 01-01-2008 to28-02-2008 House rent -1
1 01-01-2008 to28-02-2008 compensatory -1
1 01-01-2008 to28-02-2008 conveyance 0
1 01-05-2009 to31-05-2009 House rent -1
1 01-05-2008 to28-02-2009 compensatory 0
1 01-05-2009 to28-02-2009 conveyance 0
These Allowances could differ from employee to employee and also from leave
period to leave period.
Now i want to display these details of the employee(in the parent form) in
the following manner in a continous subform.
leave period houserent compensatory
conveyance
01-01-2008 to28-02-2008 checked checked not
checked
01-05-2009 to31-05-2009 checked not checked not
checked
I created unbound check boxes(a maximum of ten controls is more than enough
for the purpose)and write the following code.
'I open a recordset here on the above-shown table
rst.movefirst
'I supply the no. of allowance here
AllowanceCount = 3
For x = 1 To AllowanceCount
Forms!Form1."Label"&n.Caption = rst!Allowance
Forms!Form1."Label"&n.Visible = True
Forms!Form1."check"&n.Visible = True
rst.movenext
next
it is working for one leave period(01-01-2008 to 28-02-2008).But i have no
clue how to display the second row to show another leave period(01-05-2009 to
31-05-2009). I feel that to display this way is visually pleasing. So, can
anyone help me how to display this?
A continuous form displays as many rows as there are records
in it record source table/query. I.e. an unbound form
displayed in continuous view can not do anything mpre than a
form in single view.
To display multiple rows, you must use a bound form with a
record set that contains a record for each row you want to
display.
It might be kind of convoluted, but I think you can get the
data arranged the way you want it by using a crosstab query
as the continuous subform's record source. The trick will
be binding the check boxes to whatever allowances the query
finds. If you are willing to display every possible
allowance, you can greatly simplify things by using the
query's Column Headings property. If that's not acceptable,
then you can use a bunch of code to loop through the form's
recorset's Fields collection and set the check boxes control
source property.
--
Marsh
MVP [MS Access]
.
- Follow-Ups:
- Re: how to show two rows in an unbound continuous form
- From: Mike Painter
- Re: how to show two rows in an unbound continuous form
- From: Marshall Barton
- Re: how to show two rows in an unbound continuous form
- References:
- how to show two rows in an unbound continuous form
- From: Access infant
- Re: how to show two rows in an unbound continuous form
- From: Marshall Barton
- how to show two rows in an unbound continuous form
- Prev by Date: Re: Default Value
- Next by Date: Re: how to show two rows in an unbound continuous form
- Previous by thread: Re: how to show two rows in an unbound continuous form
- Next by thread: Re: how to show two rows in an unbound continuous form
- Index(es):
Relevant Pages
|