Dates in Visual Basic Access 2003

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter

    #1

    Dates in Visual Basic Access 2003

    I get an "Compile error: Can't find project or library"

    [DATE]= #" & Format(Me![Combo67], "MM/DD/YY") & "#;"

    The word format is highlighted as the problem. I think the code worked OK
    on Access97, but no longer works now I have upgraded to Access 2003.
    Advice appreciated
    thanks
    Peter

    The whole event is shown below:

    Private Sub Combo67_BeforeU pdate(Cancel As Integer)
    Dim SQLStmt, R As Recordset
    SQLStmt = "SELECT DISTINCT [DATE] FROM [AIRCRAFT REGISTRATIONS] WHERE
    [AIRCRAFT REGISTRATIONS].[DATE] IS NOT NULL;"
    Me![LOCATION].RowSource = SQLStmt
    Me![LOCATION].Requery
    Set R = CurrentDb.OpenR ecordset(SQLStm t)
    SQLStmt = "SELECT DISTINCT [LOCATION] FROM [AIRCRAFT REGISTRATIONS] WHERE
    [AIRCRAFT REGISTRATIONS].[LOCATION] IS NOT NULL AND [AIRCRAFT
    REGISTRATIONS].[DATE]= #" & Format(Me![Combo67], "MM/DD/YY") & "#;"
    Me![LOCATION].RowSource = SQLStmt
    Me![LOCATION].Requery
    Set R = CurrentDb.OpenR ecordset(SQLStm t)
    If R.RecordCount > 0 Then
    R.MoveLast
    If R.RecordCount = 1 Then
    Me![LOCATION] = R![LOCATION]
    End If
    End If
    End Sub


  • Tim Marshall

    #2
    Re: Dates in Visual Basic Access 2003

    Peter wrote:
    [color=blue]
    > I get an "Compile error: Can't find project or library"
    >
    > [DATE]= #" & Format(Me![Combo67], "MM/DD/YY") & "#;"
    >
    > The word format is highlighted as the problem. I think the code worked OK
    > on Access97,[/color]

    Peter, did you convert from A97? I've encountered this a couple of
    times converting my A97 apps and you need to fool around with references
    a bit. I can't quite recall which I turned off and then back on again,
    but that solved my problem.

    --
    Tim http://www.ucs.mun.ca/~tmarshal/
    ^o<
    /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
    /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me

    Comment

    Working...