MS Access and Visual Basic
Date: 08/17/05
(Code WTF) Keywords: templates, mysql, sql, microsoft
Hi. I'm trying to "beef up" one of the Access general templates for use, and I'm running into a problem.
I'm using the "Contacts Management" template, and have added a field "ReferredBy" to the Contacts table. I was wanting to add this as a search item on the "Report Date Range" form, so that I can have a report organized not only by date but grouped by ReferredBy.
I hope this makes sense, I am experienced with Access but not very experienced with Visual Basic. I've done a ton with MySQL, and thought this would be related. I guess I'm wrong... ;-)
I've been able to add the ReferredBy to the Report Date Range form. However, I get an error:
Run-time error '2465': Microsoft Access cannot find the field "|" referred to in your expression.
The VBA for the Report Date Range looks like this:
Private Sub Form_Open(Cancel As Integer)
Me.Caption = Me.OpenArgs
Me![Referred By] = [ReferredBy]
Me![Beginning Call Date] = Date - Weekday(Date, 2) + 1
Me![Ending Call Date] = Me![Beginning Call Date] + 6
End Sub
Everything works fine when I don't have the "Referredby" line in there, but it does nothing with that item... The way the code is now, it seems circular, but my brain can't figure out how to fix it.
Please help. I am so frustrated and just looking for a little help, even just where I need to go to get help.
Thank you!
x-post in sharonme
Source: http://www.livejournal.com/community/code_wtf/13145.html