![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I noticed a change in how combo boxes return the selected value between Access 97 to Access 2010. The following query is the source for a combo box returning the 2nd column SELECT qryPOInvAmount.InvAmont AS InvSum, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] FROM qryPOInvAmount GROUP BY qryPOInvAmount.InvAmont, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] ORDER BY qryPOInvAmount.InvAmont DESC; The PO number is a 0 padded number like this "00123456", Access 97 returns the number with the 0 padding; Access 2010 returns the number without the 2 leading zeros. I am looking for a setting to NOT edit the selected PO number. The combo box shows the PO number correctly. |
#3
| |||
| |||
|
|
On 23/05/2011 16:31:52, "ron paii" wrote: I noticed a change in how combo boxes return the selected value between Access 97 to Access 2010. The following query is the source for a combo box returning the 2nd column SELECT qryPOInvAmount.InvAmont AS InvSum, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] FROM qryPOInvAmount GROUP BY qryPOInvAmount.InvAmont, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] ORDER BY qryPOInvAmount.InvAmont DESC; The PO number is a 0 padded number like this "00123456", Access 97 returns the number with the 0 padding; Access 2010 returns the number without the 2 leading zeros. I am looking for a setting to NOT edit the selected PO number. The combo box shows the PO number correctly. Try SELECT InvAmount AS InvSum, Cstr(Format(PO,"0000000")), Inv FROM qryPOInvAmount GROUP BY InvAmont, GROUP BY Cstr(Format(PO,"0000000")), Inv ORDER BY InvAmont DESC; With only a single table / query as the source, you don't need to specify the query name with each field, and you only need square brackets if the field name has a space in it, or you are using a reserved word such as [Date] Phil |
#4
| |||
| |||
|
| "Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:ire1nd$gp1$1 (AT) speranza (DOT) aioe.org... On 23/05/2011 16:31:52, "ron paii" wrote: I noticed a change in how combo boxes return the selected value between Access 97 to Access 2010. The following query is the source for a combo box returning the 2nd column SELECT qryPOInvAmount.InvAmont AS InvSum, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] FROM qryPOInvAmount GROUP BY qryPOInvAmount.InvAmont, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] ORDER BY qryPOInvAmount.InvAmont DESC; The PO number is a 0 padded number like this "00123456", Access 97 returns the number with the 0 padding; Access 2010 returns the number without the 2 leading zeros. I am looking for a setting to NOT edit the selected PO number. The combo box shows the PO number correctly. Try SELECT InvAmount AS InvSum, Cstr(Format(PO,"0000000")), Inv FROM qryPOInvAmount GROUP BY InvAmont, GROUP BY Cstr(Format(PO,"0000000")), Inv ORDER BY InvAmont DESC; With only a single table / query as the source, you don't need to specify the query name with each field, and you only need square brackets if the field name has a space in it, or you are using a reserved word such as [Date] Phil Thank you Cstr(Format(PO,"0000000")) did not help. PO is a text field and the combo box shows the data correctly but A2010 is converting the return value to integer. |
#5
| |||
| |||
|
|
On 23/05/2011 18:41:45, "ron paii" wrote: "Phil" <phil (AT) stantonfamily (DOT) co.uk> wrote in message news:ire1nd$gp1$1 (AT) speranza (DOT) aioe.org... On 23/05/2011 16:31:52, "ron paii" wrote: I noticed a change in how combo boxes return the selected value between Access 97 to Access 2010. The following query is the source for a combo box returning the 2nd column SELECT qryPOInvAmount.InvAmont AS InvSum, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] FROM qryPOInvAmount GROUP BY qryPOInvAmount.InvAmont, qryPOInvAmount.[PO], qryPOInvAmount.[Inv] ORDER BY qryPOInvAmount.InvAmont DESC; The PO number is a 0 padded number like this "00123456", Access 97 returns the number with the 0 padding; Access 2010 returns the number without the 2 leading zeros. I am looking for a setting to NOT edit the selected PO number. The combo box shows the PO number correctly. Try SELECT InvAmount AS InvSum, Cstr(Format(PO,"0000000")), Inv FROM qryPOInvAmount GROUP BY InvAmont, GROUP BY Cstr(Format(PO,"0000000")), Inv ORDER BY InvAmont DESC; With only a single table / query as the source, you don't need to specify the query name with each field, and you only need square brackets if the field name has a space in it, or you are using a reserved word such as [Date] Phil Thank you Cstr(Format(PO,"0000000")) did not help. PO is a text field and the combo box shows the data correctly but A2010 is converting the return value to integer. Sorry Ron, didn't realise the question was from an experienced Access guy. I have created a table with text fields Test, values "12345" and "23456" My query for the combo rowSource is SELECT Table1.ID, Right("0000000" & [Test],8) AS Expr1 FROM Table1; On the AfterUpdate of Combo0 I run Private Sub Combo0_AfterUpdate() MsgBox "Test " & Combo0.Column(1) End Sub Results are exactly as expected, not as you describe. - Odd Using Access 2010 32 bit Phil |
#6
| |||
| |||
|
|
I will keep looking at the code. The form was originally done in Access 2, it must have some setting that makes it work different in 2010. |
#7
| |||
| |||
|
|
"ron paii" <none (AT) nospam (DOT) com> wrote in news:irir2s$2i2$1 (AT) dont-email (DOT) me: I will keep looking at the code. The form was originally done in Access 2, it must have some setting that makes it work different in 2010. Do you by chance have your A2010 database running with SQL ANSI 92 compatibility turned on? -- David W. Fenton http://www.dfenton.com/ contact via website only http://www.dfenton.com/DFA/ |
![]() |
| Thread Tools | |
| Display Modes | |
| |