Dec 29 2021 08:39 AM
Hello,
I have a form and a click event on a field that opens another form based on the Me.DDNo (double format).
I need to modify it to open frmPmtProposalALL for taking into account decimals. Little hard to explain but here is an example:
DDNo
7
7.1
If I am on a record of DDNo = 7 I also want it to open records with DDNo = 7.1.
DoCmd.OpenForm "frmPmtProposalALL", , , "DDNo =" & Me.txtDDNo
How would I adjust the above? Not sure if its a "like"?
thank you very much!
Dec 29 2021 11:32 AM - edited Dec 29 2021 11:33 AM
Solution@Tony2021 It depends, in part, on the datatype of this field in the table. It is, I understand, a double ( number which includes decimals to a specified precision).
That means Like as an operator is not appropriate. Like is used with Text, or String, values.
You can include any number with 7 as the whole number and ANY decimal amount by using a type conversion function to coerce these values:
DoCmd.OpenForm "frmPmtProposalALL", , , "Clng(DDNo) =" & Me.txtDDNo
should do it. Please try that and report back if it works as required.
Dec 29 2021 06:26 PM
Dec 29 2021 08:32 PM
Dec 30 2021 04:24 AM
Dec 30 2021 05:04 AM
Dec 30 2021 05:29 AM
Actually, it seems like I did need to modify it. I had a subtract .1 to pick up a record less than...meaning if I am on a record Me.txtDDNo = 7.1, the form that loads on the dbl click event would not load Me.txtDDNo = 7 unless I added -.1 It seems to work in my testing. thank you once again to both.
DoCmd.OpenForm "frmPmtProposalALL", , , "DDNo >= " & Me.txtDDNo & " -.1 And DDNo < " & CLng(Me.txtDDNo ) + 1
Dec 29 2021 11:32 AM - edited Dec 29 2021 11:33 AM
Solution@Tony2021 It depends, in part, on the datatype of this field in the table. It is, I understand, a double ( number which includes decimals to a specified precision).
That means Like as an operator is not appropriate. Like is used with Text, or String, values.
You can include any number with 7 as the whole number and ANY decimal amount by using a type conversion function to coerce these values:
DoCmd.OpenForm "frmPmtProposalALL", , , "Clng(DDNo) =" & Me.txtDDNo
should do it. Please try that and report back if it works as required.