Access 2007, VBA: Compile error: expected end of statement
<p>Working within Access 2007. Struggling to have database give a real time, updated amount of inventory on hand based on shipments/receipts. I was recommended the following code, but it is throwing a compile error. </p>

<pre><code>Private Sub Command62_Click()
'Arguments: ContID = Container to be reported on
' AsOfDate = the date at which quantity is to be calculated
'If missing, all transactions are included
' Return: Quantity on hand. Zero on error.

Dim db As DAO.Database   'current database
Dim rs As DAO.Recordset    ' various recordsets

Dim lngContID As Long       ' ContID as long
Dim strAsOf As String       ' AsOfDate as string
Dim strLasShipRec As String   ' Last ship date as string
Dim strDateClause As String    'Date clause to be used in SQL statement
Dim strSQL As String            ' SQL statement
Dim lngOnHand As Long     'IOnHand inventory

If Not IsNull(CONTID) Then
'Initialize: Validate and Convert parameters

Set db = CurrentDb()
lngContID = CONTID
If IsDate(AsOfDate) Then
strAsOf = "#" &amp; Format$(AsOfDate, "mm\/dd\/yyyy") &amp; "#"

'Get the LastShipRec date and quantity fo this container

If Len(strAsOf) &gt; 0 Then
strDateClause = "AND (LastShipRec&lt;="&amp;strAsOf&amp;")"
End If

strSQL = "Select Top 1 LastShipRec, Quantity FROM tblContInventory"&amp; "WHERE ((ContID = "&amp;lngContID&amp;")"&amp;strDateClause)&amp;";ORDER BY LastShipRec DESC;"
</code></pre>

<p>It is giving an 'end of statement expected' compile at:</p>

<pre><code>strSQL = "Select Top 1 LastShipRec, Quantity FROM tblContInventory"&amp; "WHERE ((ContID = "&amp;lngContID&amp;")"&amp;strDateClause)&amp;";ORDER BY `enter`LastShipRec DESC;"
</code></pre>

<p>AND </p>

<pre><code>If Len(strAsOf) &gt; 0 Then

strDateClause = "AND (LastShipRec&lt;="&amp;strAsOf&amp;")"
End If
</code></pre>

<p>Would someone be able to point me in the correct direction? How do I correct this error?</p>