Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Procedure

Status
Not open for further replies.

razchip

Technical User
Feb 2, 2001
133
US
I put together a function in Access 2000 called Function UpdatePickNChoose() (Note, it's called from a macro). Now that I need to convert it to Access 2010, I continue to get an error message: Invalid Procedure call or Argument. I can't find anything in Help to figure out what's wrong. New to Access 2010 so I appreciate any direction someone can point me in.

Thanks.

Thanks for the help.
Greg
 

If you show this Function (code) and how you call it in code, that may help...

BTW, do you have any parameter(s) that this function accepts? And what does it return?


Have fun.

---- Andy
 
When apps run fine on one machine and not on another, or run fine in one version and not when run under a newer version, one the first thing you have to think about are missing references.

If you haven't checked for this kind of thing before, here are Doug Steele's detailed instructions on how to troubleshoot the problem:

[link ]Access Reference Problems]Link[/url]

Linq ;0)>


The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Below is the function as I currently have it. I have looked at the references, but haven't found anything that was different.

Function UpdatePickNChoose()

Dim dbsCOP67200 As Database
Dim rstCOP672D As Recordset
Dim tdfCOP672D As TableDef
Dim mCurBSeq, mCurBatch, mCurCounter, mCurSeq As Integer
Dim mCurTruck
Dim mPrevTruck
Dim mPrevBseq, mPrevBatch, mPrevCounter, mPrevSeq As Integer
Dim mBSeq, mBatch, mCounter As Integer
Dim RecCount As Integer


mBSeq = 1
mBatch = 100
mCounter = 0

'DoCmd.OpenQuery "delete calculated values"

Set dbsCOP67200 = CurrentDb
Set tdfCOP672D = dbsCOP67200.CreateTableDef("COP672DTableDef")
Set rstCOP672D = _
dbsCOP67200.OpenRecordset("PickNChoose", _
dbOpenTable)
rstCOP672D.Index = "SeqNo"

With rstCOP672D

' Populate Recordset.
.MoveLast
.MoveFirst
'Set starting BSeq, Batch and Counter
.Edit
!BSeq = mBSeq
!Batch = mBatch
!Counter = mCounter
.Update

'Update variables
mPrevBseq = !BSeq
mPrevBatch = !Batch
mPrevCounter = !Counter
mPrevTruck = !TruckRt
mPrevSeq = !SeqNo

RecCount = 1

.MoveNext



Do Until .EOF

mCurBSeq = !BSeq
mCurBatch = !Batch
mCurCounter = !Counter
mCurTruck = !TruckRt
mCurSeq = !SeqNo

If mPrevTruck <> !TruckRt Then
mCurBSeq = 1

If mPrevBseq = 15 And mCurBSeq = 1 Then
mCurBatch = mPrevBatch + 1
mCurCounter = 0
ElseIf mCurTruck <> mPrevTruck Then
mCurBatch = mPrevBatch + 1
If mCurBatch <> mPrevBatch Then
mCurCounter = 0
ElseIf mCurSeq <> mPrevSeq Then
mCurCounter = mPrevCounter + 1
Else
mCurCounter = mPrevCounter
End If
Else
mCurBatch = mPrevBatch
If mCurBatch <> mPrevBatch Then
mCurCounter = 0
ElseIf mCurSeq <> mPrevSeq Then
mCurCounter = mPrevCounter + 1
Else
mCurCounter = mPrevCounter
End If

End If

Else
If mCurBatch <> mPrevBatch Then
mCurCounter = 0
ElseIf mCurSeq <> mPrevSeq Then
mCurCounter = mPrevCounter + 1
Else
mCurCounter = mPrevCounter
End If

mCurBSeq = (mCurCounter Mod 15) + 1

If mPrevBseq = 15 And mCurBSeq = 1 Then
mCurBatch = mPrevBatch + 1
mCurCounter = 0
ElseIf mCurTruck <> mPrevTruck Then
mCurBatch = mPrevBatch + 1
Else
mCurBatch = mPrevBatch
End If
End If






.Edit
!BSeq = mCurBSeq
!Batch = mCurBatch
!Counter = mCurCounter
.Update

.MoveNext

mPrevSeq = mCurSeq
mPrevTruck = mCurTruck
mPrevBseq = mCurBSeq
mPrevBatch = mCurBatch
mPrevCounter = mCurCounter

RecCount = RecCount + 1


Loop


End With

dbsCOP67200.Close
MsgBox "Update Complete on " & RecCount & " records."

End Function

Thanks for the help.
Greg
 

Your Function does not accepts any parameter(s), that's OK, but it does not return any values either.

Is tere any line that is highlighted when you get the eror message?

BTW, you may not know it, but all RED variables are Variants in your code:

Dim dbsCOP67200 As Database
Dim rstCOP672D As Recordset
Dim tdfCOP672D As TableDef
Dim [red]mCurBSeq, mCurBatch, mCurCounter[/red], mCurSeq As Integer
Dim [red]mCurTruck[/red]
Dim [red]mPrevTruck[/red]
Dim [red]mPrevBseq, mPrevBatch, mPrevCounter[/red], mPrevSeq As Integer
Dim [red]mBSeq, mBatch[/red], mCounter As Integer
Dim RecCount As Integer



Have fun.

---- Andy
 
Thanks for the help, got it to run finally.

Thanks for the help.
Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top