Thanks Joshua:
Admittedly I agree that I'm somewhat of a newbie to Python scripting and I do have a lot to learn. However, my issue here is really not with the hard coding...I can get this query to work using the physical values. The problem I'm having is getting the script to read the variable with those values that is being passed to that expression.
When the syntax is correct I also run into type issues as the program will typically crash with the error message:
ERROR 000358: Invalid expression
This "might" have something to do with data type, so my problem, I think, is learning more about quotation and how it works when using variables, plus how to pass non-strings to a variable.
To help illustrate where I'm at, I can't see the difference between:
("DateTime_2 = '201901' And MMSI = 316012834") - which works.
Or
fme_name_1b = '201901'
record11 = 316012834
("DateTime_2 = '" + str(fme_name_1b) + "' and MMSI = '" + str(record11) + "'") - which does not work
the (record11) by itself won't work in a string with + symbology, as per:
expression6 = ('MMSI = "'(record11)'"')
The behavior of the script changes when one adds a variable...so how does one pass a numeric value in a variable to expression without adding quotes or converting the value to a string?
This part of the code works: ("DateTime_2 = '" + str(fme_name_1b) + "'")
The program crashes only on this part: ("'MMSI = '" + str(record11) + "'") - or variations of which:
ExecuteError: ERROR 000358: Invalid expression
Failed to execute (SelectLayerByAttribute).
Suggestions?