Help w Compile Error please

  • Thread starter Thread starter David M via AccessMonster.com
  • Start date Start date
D

David M via AccessMonster.com

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
 
David M via AccessMonster.com said:
I have a form with a command button 'cmdXfer'.
In the procedure for cmdXfer_Click I have the following code (among other
code):
Me.pkautLeadID & ", " & _

Shouldn't those references be Me! with the exclamation point replacing the period?

Me!pkautLeadID & ", " & _

Tom Lake
 
I think you are right as far as the rigid specs go, but Me.control works fine.
In fact, if you use this format in the VBA Editor, it provides you with a
shortcut list of controls in your form.

Anyway, I found the problem. The function pfGetSQLDate is actually called
fsGetSQLDate. Somebody else wrote it and used a different naming convention.

I'm not sure why the debugger identified 'Me.cboSaleID" as the first error,
but it doesn't matter now.

Thanks for your reply,
David
 
Back
Top