antifashionpimp
Registered User.
- Local time
- Today, 09:04
- Joined
- Jun 24, 2004
- Messages
- 137
Hi all,
I have an event handler on the cmdOK button of a search form. I declare a string variable, strWhere, which represents the WHERE part of the SQL syntax used for searching.
I then call 2 functions that return strings and add them together to strWhere, as follows:
the first call(SearchAnthroMain) returns the following string:
"WHERE (qryAlleVPmEndwerte.Körperhöhe) >= 1740 AND (qryAlleVPmEndwerte.Körperhöhe) <= 1760 AND ((qryAlleVPmEndwerte.Alter) BETWEEN 20 AND 40) AND (qryAlleVPmEndwerte.VFG) = True AND"
and the second functon call(SearchAnthroSub) returns the following string:
" ((qryAlleVPmEndwerte.Beckenbreite) BETWEEN 320 AND 325) AND"
Fine, that is all correct, however, when adding the two together, it cuts off the last part of the second string, as follows(I checked this using debug.print for strWhere, and checking the value of the variable strWhere in the locals window of VBE)
"WHERE (qryAlleVPmEndwerte.Sex) = 'm' AND (qryAlleVPmEndwerte.Körperhöhe) >= 1740 AND (qryAlleVPmEndwerte.Körperhöhe) <= 1760 AND ((qryAlleVPmEndwerte.Alter) BETWEEN 20 AND 40) AND (qryAlleVPmEndwerte.VFG) = True AND ((qryAlleVPmEndwerte.Beckenbreite)"
Therefore, the following gets cut off:
BETWEEN 320 AND 325) AND
Why does it cut off the last part? Is the string data type too small? I found this on MS’s description of the string data type for VBA:
„There are two kinds of strings: variable-length and fixed-length strings.
· A variable-length string can contain up to approximately 2 billion (2^31) characters.
· A fixed-length string can contain 1 to approximately 64K (2^16) characters.
Note Public fixed-length string can't be used in a class module.“
I still cannot figure why it is cutting off the last bit though. Does anyone maybe know where I missed something perhaps?
Thanks for your attention!
regards,
jean
I have an event handler on the cmdOK button of a search form. I declare a string variable, strWhere, which represents the WHERE part of the SQL syntax used for searching.
I then call 2 functions that return strings and add them together to strWhere, as follows:
Code:
strWhere = strWhere & SearchAnthroMain(Me, intSex, strSTLProp, strVFG)
strWhere = strWhere & SearchAnthroSub(Forms!frmPopUp_ZusätzVermessungen)
the first call(SearchAnthroMain) returns the following string:
"WHERE (qryAlleVPmEndwerte.Körperhöhe) >= 1740 AND (qryAlleVPmEndwerte.Körperhöhe) <= 1760 AND ((qryAlleVPmEndwerte.Alter) BETWEEN 20 AND 40) AND (qryAlleVPmEndwerte.VFG) = True AND"
and the second functon call(SearchAnthroSub) returns the following string:
" ((qryAlleVPmEndwerte.Beckenbreite) BETWEEN 320 AND 325) AND"
Fine, that is all correct, however, when adding the two together, it cuts off the last part of the second string, as follows(I checked this using debug.print for strWhere, and checking the value of the variable strWhere in the locals window of VBE)
"WHERE (qryAlleVPmEndwerte.Sex) = 'm' AND (qryAlleVPmEndwerte.Körperhöhe) >= 1740 AND (qryAlleVPmEndwerte.Körperhöhe) <= 1760 AND ((qryAlleVPmEndwerte.Alter) BETWEEN 20 AND 40) AND (qryAlleVPmEndwerte.VFG) = True AND ((qryAlleVPmEndwerte.Beckenbreite)"
Therefore, the following gets cut off:
BETWEEN 320 AND 325) AND
Why does it cut off the last part? Is the string data type too small? I found this on MS’s description of the string data type for VBA:
„There are two kinds of strings: variable-length and fixed-length strings.
· A variable-length string can contain up to approximately 2 billion (2^31) characters.
· A fixed-length string can contain 1 to approximately 64K (2^16) characters.
Note Public fixed-length string can't be used in a class module.“
I still cannot figure why it is cutting off the last bit though. Does anyone maybe know where I missed something perhaps?
Thanks for your attention!

regards,
jean