I haven't messed with VBA much before, or Access or SQL. But i have a little... and I'm working on a project. So, the goal here is to enter a name, take that name and search for that name in a linked table. I'm told I can do this with an SQL Query? But how? Do I need to use an SQL Query?
I've tried quite a few things, but I never get much closer to my answer. I've tried this...
'strTable1 = "FAC_List"
'Dim cellFind As Object
'cellFind = Workbooks("FAC List.xlsx").Sheets("Sheet1").Range("A2").Find(what:=txtLDcode)
'Dim rowNum As Integer
'Dim cellFind As Object
'rowNum = 0
'Do
' rowNum = rowNum + 1
' Set cellFind = Workbooks("FAC List.xlsx").Sheets("Sheet1").Range("A" & rowNum)
'
' If InStr(cellFind, txtLDcode) Then
' txtLDcode = True
'
' End If
'Loop Until cellFind = ""
'If Not cellFind Is Nothing Then
' Set txtLDcode = True
'End If
The "Set cellFind" part always returns an error with Workbooks...I've also tried this below...
'Dim objRecordset As ADODB.Recordset
'Set objRecordset = New ADODB.Recordset
'Dim i As Integer
'Dim value As Variant
'objRecordset.ActiveConnection = CurrentProject.Connection
'objRecordset.Open "FAC_List"
'While objRecordset.EOF = False
'check for match
' If objRecordset.Fields.Item(0).value = txtLDcode Then
' txtLDcode = True
' Else
'txtLDcode = False
' End If
' objRecordset.MoveNext
'Wend
But the problem with the last part is it always returns False... My linked-Table name is FAC_List. Once the user inputs some information, that info is suppose to be searched in a table and basically only return True/False. How can I achieve this, and am I going in the right direction?