Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Posts
    67

    Unanswered: help w Compile Error please

    I have a form with a command button 'cmdXfer'.
    In the procedure for cmdXfer_Click I have the following code (among other
    code):

    DBEngine.Workspaces(0).BeginTrans
    CurrentDb.Execute "INSERT INTO [tjctDistributions] (" & _
    "fkautLeadID, fkautSaleID, intDistrNum, dtmDistrDate, "
    & _
    "fkstrDistrType, dtmXfered, fkautEmployeeID,
    strBrokerName, " & _
    ") VALUES (" & _
    Me.pkautLeadID & ", " & _
    Me.cboSaleID & ", " & _
    intNextDistrNum & ", " & _
    pfGetSQLDate(Now()) & ", " & _
    "'XML', " & _
    pfGetSQLDate(Me.txtDateXfered) & ", " & _
    Me.cboEmployeeID & ", " & _
    "'" & Me.txtBrokerName & "'" & _
    ")", dbFailOnError
    DBEngine.Workspaces(0).CommitTrans

    I'm getting 'COMPILE ERROR: SUB OR FUNCTION NOT DEFINED'' on each of the 'Me.
    ' references. They are definitely valid fields/controls on the current form.
    They even appear automatically after typing 'Me.'. If I substitutute (hard-
    code) a number for any of them, the error moves past to the next 'Me.'
    reference. If I type them with the field names but without the actual 'Me.'
    then I still get the same error.

    Thanks in advance for your help,
    David

  2. #2
    Join Date
    Jul 2004
    Posts
    67
    Nevermind - function name was wrong.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    me

    You also want to use me! instead of me.

    me. refers to the control while me! refers to the value!

    Access might be forgiving on this but me! is the correct punctuation to use.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by pkstormy
    You also want to use me! instead of me.

    me. refers to the control while me! refers to the value!

    Access might be forgiving on this but me! is the correct punctuation to use.
    Are you sure about that one Paul? I'm not sure your distinction between the bang and period are quite right and, in any case, I think there is some difference of opinion on the matter e.g. Bang Vs Dot

    Personally speaking - I always code as David a) for intellisense and b) to trap errors at compile time rather than run time (though b isn't too important because of a)
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    funstuff!!

    i understood the rule to be

    Collection!itemInCollection.itemProperty

    with the DAOist extension:

    dim recs as dao.recordset
    set recs = currentdb.openrecordset ("SELECT * FROM tblBlah;")
    recs.movelast
    myFormBox = recs!myField

    ...reasonably making recs a "collection" i suppose, and talking to the field's default .Value property

    izy
    currently using SS 2008R2

Posting Permissions

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