Re: how to show two rows in an unbound continuous form

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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]
.

.



Relevant Pages

  • Re: Conditional formatting in a Crosstab Query
    ... decide on a maximum number of months to display on the form. ... that makes the row heading a relative month number: ... >But now I have another problem.Since this form is generated by a crosstab ... >query and the fields are filtered months ),next month I will have the ...
    (microsoft.public.access.queries)
  • Re: Tricky query question
    ... Crosstabs always display the derived columns on the right. ... Row Heading to display on the right without displaying in another query, ... You can calculate a Row Heading YTD. ... this can't display in the crosstab on the right. ...
    (microsoft.public.access.queries)
  • Re: What are these?
    ... If you create a query using your table, you will see that the FileData, FileName and FileType are available in the table in the upper pane of query design. ... If you drag show the attachment field's FileType in the grid, it will display JPG or DOC or whatever type it is. ... When I dragged them onto the form, Documents.FileData is identified as an Attachment, with a ControlSource as Documents.FileData. ...
    (microsoft.public.access.forms)
  • Re: Use crosstab column heading in a calculation
    ... subform could be used as a kind of blank display screen to display the ... results of any query. ... >crosstab has defined column headings. ...
    (microsoft.public.access.queries)
  • Re: How do I make this report???
    ... To display a different format in your column headings, ... > a crosstab to return a specific number of months' data for instance 3 ... > When using this query in a report, you can use text boxes for column ... However, I used the report ...
    (microsoft.public.access.reports)