Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Posts
    559

    Unanswered: Won't pass date?!?

    On the db that I'm doing, I've created a calendar form (frmCalendar) which when a user double-clicks any date box is pulled up. It uses this code:
    Code:
    Call PosCalendar(Me, "Calendar3", "Date_of_Birth")
    This works fine.

    However, when the user clicks the date they want and then the "Insert Date" it returns an error on the passing of the date back to the control.

    The code on that control is:

    Code:
    Form!frmIndividual.Controls (Me.Calendar3.Tag) = Me.Calendar3.Value
    Form!frmIndividual.Controls (Me.Calendar3.Tag).SetFocus
    Me.Calendar3.Tag = ""
    DoCmd.Close acForm, "frmCalendar"
    The issue is that it gives me a syntax error passing the date back and highlights the first line of the code on the above (Form!frmIndividual.Controls (Me.Calendar3.Tag) = Me.Calendar3.Value

    Any ideas on why this may be? I'm going to have to reuse this code on a few subforms so I want to make sure I get it correct.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Why not just use ActiveControl? Then you neither have to pass the fieldname to the calendar form, nor deal with specifying it during close.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I'd also check out the 3-4 different calendar examples in the code bank if you get a chance. They're very easy to integrate into your mdb (ie. just import the calendar form) and call (ie. open) the calendar form in the OnGotFocus event of the date field (or put a button next to the field.)

    I particularly like this one (and not just because I designed it: )

    http://www.dbforums.com/showpost.php...4&postcount=30

    but here's another:

    http://www.dbforums.com/showpost.php...8&postcount=34
    Last edited by pkstormy; 08-26-08 at 00:25.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Aug 2006
    Posts
    559
    Thanks Trek and Paul, I'll take a look.

    **EDIT**

    I like the first one, the one you did just cause it's big and people won't confuse what they're doing. I am going to try and make an attempt at integrating something like what you did with the subform date calling the calendar form, then putting the date back in using the calendar form that I already have in my db. (just for continuity or whatever that word is).
    Last edited by Grafixx01; 08-26-08 at 11:13.

  5. #5
    Join Date
    Aug 2006
    Posts
    559
    Alright, I'm trying to integrate it now just inserting the Individual's DOB on the main form. The calendar form pops up without any issues but I get an error 2465 for not being able to find the field.

    I think that I've got it a little messed up as the code on the double-click event of the DOB text box is:

    Code:
    DoCmd.OpenForm "CalPopUp"
    Forms!CalPopUp!FormName = "frmIndividual"
    '(commented out as there is no subform)Forms!CalPopUp!SubFormName = "MainFormSub"
    Forms!CalPopUp!FieldName = "DOB"
    I've tried to put in the form and field name where you have "FormName" but it still returns an error. Is there something stupid that I'm over-looking?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •