hi all


i have command button which opens ms access form " new job" and filters Id by cell value but i would like it to only check the first 4 numbers in the cell
and not check the other charactors in the cell

here my code :
Option Explicit

Global oApp As Object

Sub OpenAccess()

   Dim LPath As String
   Dim LCategoryID As Long
    Dim str As String
    Dim ac As Object


   'Path to Access database
   LPath = "C:\Users\Shane\Desktop\ planner.accdb"
   
   'Open Access and make visible
   Set oApp = CreateObject("Access.Application")
   oApp.Visible = True
   
   'Open Access database as defined by LPath variable
   oApp.OpenCurrentDatabase LPath
   
   'Open form called Categories filtering by CategoryID
   On Error Resume Next
   LCategoryID = ActiveCell.Value
   oApp.DoCmd.OpenForm "new job", , , "ID = " & LCategoryID
   
End Sub
thanks in advance

Shane