Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calendar grid subform help 1

Status
Not open for further replies.

lowtek

Technical User
Apr 1, 2002
18
US
Hello,
I have created a "calendar grid" on a subform in this way:
I have 12 rows of unbound textboxes, 31 textboxes per row. The 12 rows correspond to 12 months and 31 textboxes per row represents up to 31 days in a month. I have named each unbound textbox as "01/01" for the first row first column textbox, "01/02" for the first row second textbox, and so on up to the last row last column textbox which is "12/31".

I have a select query that returns the date and a one or two letter symbol for an event that happens on that date (e.g. date = "04/05" and symbol = "A"). What I would like to do is have the "A" appear in the unbound textbox named "04/05" which corresponds to the date that this event took place.

What is the best way to make this happen? Also, maybe there is a better way to do this than my line of thinking. Any help or suggestion is welcome.

thank you,
Rey
 
I still can't think why you would want to do this.

Code:
Private Sub cmdClickMe_Click()
Set rs = CurrentDb.OpenRecordset("Select Format(Field1,'mm/dd') As ctlname, Field2 From tblTable")

Do While Not rs.EOF
    Me.Controls(rs!ctlname) = Me.Controls(rs!ctlname) & rs!field2
    rs.MoveNext
Loop
End Sub
 
Thank you for your help--I appreciate the time and effort. I have a "run-time error 3061, too few parameters expected 2" when I run the code...any suggestions? I modified your code to

Set rs = CurrentDb.OpenRecordset ("Select Format(GRID,'mm/dd') As ctlname, SYMBOL From qry_Attendance1")

Do While Not rs.EOF
Me.Controls(rs!ctlname) = Me.Controls(rs!ctlname) & rs!SYMBOL
rs.MoveNext
Loop

Rey
 
Check your table to make sure that 'grid' and 'symbol' are the correct field names.
 
Paste:
[tt]Select Format(GRID,'mm/dd') As ctlname, SYMBOL From qry_Attendance1[/tt]
into the query design window, SQL view, and see how it works as a query.
The error you are getting is something to do with the SQL string, as far as I know.
 
I pasted the sql and ran it in a select query and it works fine.
 
Okay...figured it out. I changed the priority of DAO reference to that higher than the reference to ActiveX...thank you very much for the code...it works exactly how I want it to.
Rey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top