Question
-
Topic
-
Is this a bug or the proper operation of InStr in Access?
LockedI’m trying to parse out the numbers within an IP address in order to turn them into a range that I can test within Access. I’m having a problem with creating the length of the field for the Mid$ statement.
Here’s the IP address:
172.16.160.0
What’s happening is this statement returns 8 which is the correct:
InStr(InStr(1,[Firewall Rules]![Source IP],”.”)+1,[Firewall Rules]![Source IP],”.”)+1
If I take that EXACT same InStr statement and put a minus sign in front:
-InStr(InStr(1,[Firewall Rules]![Source IP],”.”)+1,[Firewall Rules]![Source IP],”.”)+1
It returns a -6
Does it start stepping through the string backwards?
Figured it out – was negating the +1 so just wrapped it all into parentheses and it works like this:
-(InStr(InStr(1,[Firewall Rules]![Source IP],”.”)+1,[Firewall Rules]![Source IP],”.”)+1)