Compile Error - Argument Not Optional

I'm testing some code to send field info into variables.  All come in except one [Load].  I've got another textbox to display the value without any problem, but the code will not compile when I assign the value to a variable.  If I comment the line out then it compiles OK.
The code is as follows:

Private Sub cboCurrentRte_AfterUpdate()

Dim rst As Recordset, strCriteria As String
Dim strRte, strAMoutW, strAMoutGr, strAMoutMd, strAMoutStrt As String
Dim dbInside, dbObt, dbRefuel, dbLoad, dbObtVal, dbHH, dbUC, dbSpecAssist As Double

    strCriteria = "[RES_ROUTE] = '" & Me.cboCurrentRte & "'"
    Set rst = Me.RecordsetClone
    rst.FindFirst strCriteria
    If rst.NoMatch Then
        MsgBox ("Not Updated")
    Else
        Me.Bookmark = rst.Bookmark
    End If
       
    strRte = [RES_ROUTE]
    dbInside = [LcInside]
    dbObt = [Obtain]
    dbRefuel = [Refuel]
   
    dbLoad = 0.89
    dbLoad = [Load]    '<<< error occurs here - Load is highlighted and the compiler stops at the AfterUpdate line
    dbObtVal = IIf(Nz(dbObt) = 0, 0, (Nz(dbObt) + Nz(dbLoad) + 5))
    dbHH = [HHval]
    dbUC = [CUCT]
    dbSpecAssist = PlusMinus([SPECTAM], [ASSISTAM])
   
    'MsgBox (Str(dbInside))
    'Me.txtHH.SetFocus
     Me.txtR2hh = dbInside + 1000
       
End Sub
bakerdjAsked:
Who is Participating?
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.

flavoCommented:
1st thing

Dim rst As Recordset, strCriteria As String
Dim strRte, strAMoutW, strAMoutGr, strAMoutMd, strAMoutStrt As String
Dim dbInside, dbObt, dbRefuel, dbLoad, dbObtVal, dbHH, dbUC, dbSpecAssist As Double

cant do this..

this line for example will return

Dim strRte, strAMoutW, strAMoutGr, strAMoutMd, strAMoutStrt As String

varriant,   varriant,      varriant,      varriant,        string

You should do them all on seperate lines like

dim a as string
dim b as string etc...

.Net you can do this, VBA you cant.


You clould try

dbLoad = Me.[Load].Value

Dave
0
Bat17Commented:
I think that you have run foul of a Reserved Word in Access, try renaming the field to txtLoad and see what happens

Peter
0

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
bakerdjAuthor Commented:
Peter,

I changed the field name to AMload and it works.  I searched help in Access and VB and LOAD is a statement in VB.

thanks

Dennis
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.