My Assistant
![]() ![]() |
|
|
May 1 2007, 03:20 PM
Post
#1
|
|
|
UtterAccess Addict Posts: 194 |
I have calender that appears after you click on the date field. I made it more universal so I didn't have a bunch of invisible calender controls all over my form. I had it working until I tried to change the default date to of the calender by passing a date through in my UDF (OpenCalendar). I keep getting the error "Syntax Error", why would I get this on adding a second parameter??
Here is the code: CODE 'In forms module Private Sub DateReceived_Click() OpenCalendar ("DR", Me.DateReceived) End Sub Private Sub EventDate_Click() OpenCalendar ("ED", Me.EventDate) End Sub 'In it's own module Global st as String Public Function OpenCalendar(start As String, d As Date) Forms!EventEntry!Calendar0.Visible = True If IsNull(d) Then Forms!EventEntry!Calander0.Value = Date Else Forms!EventEntry!Calander0.Value = d End If st = start End Function |
|
|
|
May 1 2007, 03:34 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 23,583 From: Mississippi |
I think the problem is that the parameter d which is of type Date cannot accept a Null value. Change its type to Variant.
|
|
|
|
May 1 2007, 03:57 PM
Post
#3
|
|
|
UtterAccess Addict Posts: 194 |
I changed its type to a variant.
I still get the syntax error when I try to compile at this line: OpenCalendar ("DR", Me.DateReceived). When I type in the same line again to make sure the syntax is correct I get an "expected: =" error. |
|
|
|
May 1 2007, 04:05 PM
Post
#4
|
|
|
UtterAccess Addict Posts: 194 |
I dimed a temp variable to get the value of me.daterecieved just in case it had problems passing a me.value. I still got an error it compiles with one argument, but not two. Which leads me to believe that the problem is in the function (but it doesn't make sense, I should be able to pass 2 arguments of different type).
|
|
|
|
May 2 2007, 08:34 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 23,583 From: Mississippi |
Yes, I agree with that. Could it be some kind of corruption? Try this, copy the code of the function. Add a new module, then paste the code into that one.
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 11:45 PM |