Feb 21 2023 03:14 PM - edited Feb 21 2023 04:21 PM
Editing a state data field. Hitting a table called "States". If i get a hit then data entry is good otherwise invalid entry. So only needs to return one record. When i hardcode the state ""KS"" it works fine. Use the string variable, EOF. Print the variable in immediate window value is KS. Stop execution and point at the variable value is, "KS" with the quotes, and throws EOF.
The query runs executes perfectly in query designer. RecCount = -1. Very simple query. Very confused. Please help!!
Set objRecordset = New ADODB.Recordset
objRecordset.ActiveConnection = CurrentProject.Connection
'objRecordset.Open SQLval
objRecordset.Open "SELECT States.[State Abbreviation], States.State FROM States WHERE (((States.[State Abbreviation]) = [State]));"
RecCount = objRecordset.RecordCount
If objRecordset.EOF = True Then
Feb 21 2023 05:31 PM - edited Feb 21 2023 05:32 PM
you can use DAO.Recordset also.
your current query will not include Null (empty) for [State Abbreviation] Or [State].
always test for both .BOF And .EOF.
Feb 21 2023 06:35 PM
@arnel_gp Thanks for your response! I will convert this to DAO and see if it handles the query better. Will also check for both EOF and BOF. I hope this helps. I will be a couple days before i can get back to this. I will respond again. Again, thanks.