MS Access Record Source is not working - but does work on earlier version of Access.

%3CLINGO-SUB%20id%3D%22lingo-sub-1519573%22%20slang%3D%22en-US%22%3EMS%20Access%20Record%20Source%20is%20not%20working%20-%20but%20does%20work%20on%20earlier%20version%20of%20Access.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1519573%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20free%20text%20search%20using%20the%20following%20code%20based%20on%20input%20into%20a%20textbox%20(T9)%3A%3C%2FP%3E%3CP%3EDim%20SString%20As%20String%3CBR%20%2F%3EDim%20strText%20As%20String%3C%2FP%3E%3CP%3EIf%20IsNull(Me.T9)%20Then%3CBR%20%2F%3EExit%20Sub%3CBR%20%2F%3EEnd%20If%3C%2FP%3E%3CP%3EstrText%20%3D%20Me.T9.Value%3CBR%20%2F%3ESString%20%3D%20%22Select%20*%20From%20TblOrdersQ%20Where%20((%5BTeamName%5DLike%20%22%22*%22%20%26amp%3B%20strText%20%26amp%3B%20%22*%22%22)%20%22%20_%3CBR%20%2F%3E%26amp%3B%20%22%20Or%20(%5BBatch_ID%5D%20Like%20%22%22*%22%20%26amp%3B%20strText%20%26amp%3B%20%22*%22%22)%20%22%20_%3CBR%20%2F%3E%26amp%3B%20%22%20Or%20(%5BPart_ID%5D%20Like%20%22%22*%22%20%26amp%3B%20strText%20%26amp%3B%20%22*%22%22)%20%22%20_%3CBR%20%2F%3E%26amp%3B%20%22%20Or%20(%5BMyProfileDescript%5D%20Like%20%22%22*%22%20%26amp%3B%20strText%20%26amp%3B%20%22*%22%22)%20%22%20_%3CBR%20%2F%3E%26amp%3B%20%22%20or%20(%5BMyAlias%5D%20Like%20%22%22*%22%20%26amp%3B%20strText%20%26amp%3B%20%22*%22%22)%20%22%20_%3CBR%20%2F%3E%26amp%3B%20%22%20or%20(%5BBoxTypeID%5D%20Like%20%22%22*%22%20%26amp%3B%20strText%20%26amp%3B%20%22*%22%22))%20%22%3CBR%20%2F%3EMe.RecordSource%20%3D%20SString%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20used%20this%20exact%20same%20code%20on%20many%20MS%20Access%20databases%20but%20for%20some%20reason%2C%20when%20I%20created%20a%20new%20one%20in%20Office%20365%20this%20code%20does%20not%20work.%20However%2C%20on%20another%20machine%2C%20with%20Access%2064%20bit%20it%20works%20just%20fine.%20As%20well%2C%20other%20MS%20Access%20databases%20I%20created%20over%20the%20past%20two%20years%20have%20the%20same%20code%20and%20the%20same%20set%20up%20to%20search%20via%20textbox%20entry%20-%20all%20work%20just%20fine.%20Any%20ideas%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20used%20to%20search%20a%20continuous%20form.%20The%20back%20end%20data%20is%20stored%20in%20SQL%20Server.%20The%20form%20is%20bound%20to%20a%20Select%20query%20(TblOrdersQ)%20in%20Access.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1519573%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Visitor

I have a free text search using the following code based on input into a textbox (T9):

Dim SString As String
Dim strText As String

If IsNull(Me.T9) Then
Exit Sub
End If

strText = Me.T9.Value
SString = "Select * From TblOrdersQ Where (([TeamName]Like ""*" & strText & "*"") " _
& " Or ([Batch_ID] Like ""*" & strText & "*"") " _
& " Or ([Part_ID] Like ""*" & strText & "*"") " _
& " Or ([MyProfileDescript] Like ""*" & strText & "*"") " _
& " or ([MyAlias] Like ""*" & strText & "*"") " _
& " or ([BoxTypeID] Like ""*" & strText & "*"")) "
Me.RecordSource = SString

 

I have used this exact same code on many MS Access databases but for some reason, when I created a new one in Office 365 this code does not work. However, on another machine, with Access 64 bit it works just fine. As well, other MS Access databases I created over the past two years have the same code and the same set up to search via textbox entry - all work just fine. Any ideas?

 

This is used to search a continuous form. The back end data is stored in SQL Server. The form is bound to a Select query (TblOrdersQ) in Access.

0 Replies