passing a value in access vba 2013

I am having trouble passing a value.

The main routine works with only one variable passed to the submitVIN routine but when trying to pass VRR_VehicleID it highlights the line red.

Public Sub Main()
Dim dbs As DAO.Database
Dim rstVins As DAO.Recordset
Set dbs = CurrentDb
Set rstVins = dbs.OpenRecordset("QryBaseDataAllModels")
Dim x As Long
Dim counter As Long
counter = 0
varReturn = SysCmd(acSysCmdSetStatus, "Text to write on the Status Bar!")

With rstVins
.MoveLast
x = .RecordCount
Debug.Print "total records: " & x
    .MoveFirst
   
  
'method one
    Do Until .EOF
 
 varReturn = SysCmd(acSysCmdSetStatus, counter)


Debug.Print .Fields("Vintouse").Value

'************** red here ***************************
SubmitVIN(.Fields("Vintouse").Value, .Fields("VRR_VehicleID").Value)

  varReturn = SysCmd(acSysCmdSetStatus, " ")
     counter = counter + 1
    VehID = VehID + 1
    .MoveNext
   
    x = x - 1
    Debug.Print x
    Loop
End With
MsgBox ("end")
End Sub

Open in new window


submitvin header : Public Sub SubmitVIN(strVIN As String, VehIn As Long)
PeterBaileyUkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
change:

SubmitVIN(.Fields("Vintouse").Value, .Fields("VRR_VehicleID").Value)

to:

call SubmitVIN(.Fields("Vintouse").Value, .Fields("VRR_VehicleID").Value)

?

AND what's the error message you get? can you post the scripts for sub SubmitVIN ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rgonzo1971Commented:
Hi,

pls try

SubmitVIN .Fields("Vintouse").Value, .Fields("VRR_VehicleID").Value
'or
SubmitVIN .Fields("Vintouse").Value, cLng(.Fields("VRR_VehicleID").Value)

Open in new window


Regards
PeterBaileyUkAuthor Commented:
worked a treat thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.