value of combo box can not be read

  • Thread starter Thread starter Dejan
  • Start date Start date
D

Dejan

I have problem with assigning the value of combo box to
variable. When user clicks on command button on same
form....

Private Sub Command24_Click()
Forms!QtrlyRptIntl!Country.SetFocus
Forms!QtrlyRptIntl!Country.Value = TempValue
DoCmd.RunSQL "UPDATE tQtrRptIntlIncome SET
tQtrRptIntlIncome.[1stQtrTotal] = (([1stQtrIncGrp])+
([1stQtrIncSales])+([1stQtrIncOther])),tQtrRptIntlIncome.
[2ndQtrTotal] = (([2ndQtrIncGrp])+([2ndQtrIncSales])+
([2ndQtrIncOther])),tQtrRptIntlIncome.[3rdQtrTotal] =
(([3rdQtrIncGrp])+([3rdQtrIncSales])+
([3rdQtrIncOther])),tQtrRptIntlIncome.[4thQtrTotal] =
(([4thQtrIncGrp])+([4thQtrIncSales])+
([4thQtrIncOther])),tQtrRptIntlIncome.YTDTithe =
(([1stQtrTithe])+([2ndQtrTithe])+([3rdQtrTithe])+
([4thQtrTithe])) Where Country=" + "'" + TempValue + "'"
DoCmd.OpenStoredProcedure "Qupd-
tQtrIncomeIntlYTDTotal", acViewNormal, acEdit
DoCmd.OpenStoredProcedure "Qupd-tQtrLdrshipIntl",
acViewNormal, acEdit
End Sub

.....TempValue is always blank(="").
Anybody knows why?
Thanks
 
When does TempValue get set? What is TempValue?

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
TempValue is public variable and it is set at begining of
module:
Option Compare Database
Option Explicit
Dim TempValue As String
-----Original Message-----
When does TempValue get set? What is TempValue?

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Dejan said:
I have problem with assigning the value of combo box to
variable. When user clicks on command button on same
form....

Private Sub Command24_Click()
Forms!QtrlyRptIntl!Country.SetFocus
Forms!QtrlyRptIntl!Country.Value = TempValue
DoCmd.RunSQL "UPDATE tQtrRptIntlIncome SET
tQtrRptIntlIncome.[1stQtrTotal] = (([1stQtrIncGrp])+
([1stQtrIncSales])+ ([1stQtrIncOther])),tQtrRptIntlIncome.
[2ndQtrTotal] = (([2ndQtrIncGrp])+([2ndQtrIncSales])+
([2ndQtrIncOther])),tQtrRptIntlIncome.[3rdQtrTotal] =
(([3rdQtrIncGrp])+([3rdQtrIncSales])+
([3rdQtrIncOther])),tQtrRptIntlIncome.[4thQtrTotal] =
(([4thQtrIncGrp])+([4thQtrIncSales])+
([4thQtrIncOther])),tQtrRptIntlIncome.YTDTithe =
(([1stQtrTithe])+([2ndQtrTithe])+([3rdQtrTithe])+
([4thQtrTithe])) Where Country=" + "'" + TempValue + "'"
DoCmd.OpenStoredProcedure "Qupd-
tQtrIncomeIntlYTDTotal", acViewNormal, acEdit
DoCmd.OpenStoredProcedure "Qupd-tQtrLdrshipIntl",
acViewNormal, acEdit
End Sub

....TempValue is always blank(="").
Anybody knows why?
Thanks


.
 
There is nothing in this code that ever assigns a value to TempValue variable. That
is why it is still = to "".

Dejan said:
I think that I'm having this problem because all fields on
current form become empty when I click mentioned command
button.
Why is that happening?
-----Original Message-----
I have problem with assigning the value of combo box to
variable. When user clicks on command button on same
form....

Private Sub Command24_Click()
Forms!QtrlyRptIntl!Country.SetFocus
Forms!QtrlyRptIntl!Country.Value = TempValue
DoCmd.RunSQL "UPDATE tQtrRptIntlIncome SET
tQtrRptIntlIncome.[1stQtrTotal] = (([1stQtrIncGrp])+
([1stQtrIncSales])+([1stQtrIncOther])),tQtrRptIntlIncome.
[2ndQtrTotal] = (([2ndQtrIncGrp])+([2ndQtrIncSales])+
([2ndQtrIncOther])),tQtrRptIntlIncome.[3rdQtrTotal] =
(([3rdQtrIncGrp])+([3rdQtrIncSales])+
([3rdQtrIncOther])),tQtrRptIntlIncome.[4thQtrTotal] =
(([4thQtrIncGrp])+([4thQtrIncSales])+
([4thQtrIncOther])),tQtrRptIntlIncome.YTDTithe =
(([1stQtrTithe])+([2ndQtrTithe])+([3rdQtrTithe])+
([4thQtrTithe])) Where Country=" + "'" + TempValue + "'"
DoCmd.OpenStoredProcedure "Qupd-
tQtrIncomeIntlYTDTotal", acViewNormal, acEdit
DoCmd.OpenStoredProcedure "Qupd-tQtrLdrshipIntl",
acViewNormal, acEdit
End Sub

.....TempValue is always blank(="").
Anybody knows why?
Thanks
.
 
Declaring the variable...
i.e. Dim TempValue As String

....is not the same as assigning a value to the variable.
TempValue = "Put something here"


Dejan said:
TempValue is public variable and it is set at begining of
module:
Option Compare Database
Option Explicit
Dim TempValue As String
-----Original Message-----
When does TempValue get set? What is TempValue?

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Dejan said:
I have problem with assigning the value of combo box to
variable. When user clicks on command button on same
form....

Private Sub Command24_Click()
Forms!QtrlyRptIntl!Country.SetFocus
Forms!QtrlyRptIntl!Country.Value = TempValue
DoCmd.RunSQL "UPDATE tQtrRptIntlIncome SET
tQtrRptIntlIncome.[1stQtrTotal] = (([1stQtrIncGrp])+
([1stQtrIncSales])+ ([1stQtrIncOther])),tQtrRptIntlIncome.
[2ndQtrTotal] = (([2ndQtrIncGrp])+([2ndQtrIncSales])+
([2ndQtrIncOther])),tQtrRptIntlIncome.[3rdQtrTotal] =
(([3rdQtrIncGrp])+([3rdQtrIncSales])+
([3rdQtrIncOther])),tQtrRptIntlIncome.[4thQtrTotal] =
(([4thQtrIncGrp])+([4thQtrIncSales])+
([4thQtrIncOther])),tQtrRptIntlIncome.YTDTithe =
(([1stQtrTithe])+([2ndQtrTithe])+([3rdQtrTithe])+
([4thQtrTithe])) Where Country=" + "'" + TempValue + "'"
DoCmd.OpenStoredProcedure "Qupd-
tQtrIncomeIntlYTDTotal", acViewNormal, acEdit
DoCmd.OpenStoredProcedure "Qupd-tQtrLdrshipIntl",
acViewNormal, acEdit
End Sub

....TempValue is always blank(="").
Anybody knows why?
Thanks


.
 
I guess problem was not enough rest :)
Thank you
-----Original Message-----
Declaring the variable...
i.e. Dim TempValue As String

....is not the same as assigning a value to the variable.
TempValue = "Put something here"


Dejan said:
TempValue is public variable and it is set at begining of
module:
Option Compare Database
Option Explicit
Dim TempValue As String
-----Original Message-----
When does TempValue get set? What is TempValue?

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

I have problem with assigning the value of combo box to
variable. When user clicks on command button on same
form....

Private Sub Command24_Click()
Forms!QtrlyRptIntl!Country.SetFocus
Forms!QtrlyRptIntl!Country.Value = TempValue
DoCmd.RunSQL "UPDATE tQtrRptIntlIncome SET
tQtrRptIntlIncome.[1stQtrTotal] = (([1stQtrIncGrp])+
([1stQtrIncSales])+ ([1stQtrIncOther])),tQtrRptIntlIncome.
[2ndQtrTotal] = (([2ndQtrIncGrp])+([2ndQtrIncSales])+
([2ndQtrIncOther])),tQtrRptIntlIncome.[3rdQtrTotal] =
(([3rdQtrIncGrp])+([3rdQtrIncSales])+
([3rdQtrIncOther])),tQtrRptIntlIncome.[4thQtrTotal] =
(([4thQtrIncGrp])+([4thQtrIncSales])+
([4thQtrIncOther])),tQtrRptIntlIncome.YTDTithe =
(([1stQtrTithe])+([2ndQtrTithe])+([3rdQtrTithe])+
([4thQtrTithe])) Where Country=" + "'" + TempValue + "'"
DoCmd.OpenStoredProcedure "Qupd-
tQtrIncomeIntlYTDTotal", acViewNormal, acEdit
DoCmd.OpenStoredProcedure "Qupd-tQtrLdrshipIntl",
acViewNormal, acEdit
End Sub

....TempValue is always blank(="").
Anybody knows why?
Thanks


.


.
 
I will have to take some days off to get into shape
again :)
Thank you
-----Original Message-----
There is nothing in this code that ever assigns a value to TempValue variable. That
is why it is still = to "".

Dejan said:
I think that I'm having this problem because all fields on
current form become empty when I click mentioned command
button.
Why is that happening?
-----Original Message-----
I have problem with assigning the value of combo box to
variable. When user clicks on command button on same
form....

Private Sub Command24_Click()
Forms!QtrlyRptIntl!Country.SetFocus
Forms!QtrlyRptIntl!Country.Value = TempValue
DoCmd.RunSQL "UPDATE tQtrRptIntlIncome SET
tQtrRptIntlIncome.[1stQtrTotal] = (([1stQtrIncGrp])+
([1stQtrIncSales])+ ([1stQtrIncOther])),tQtrRptIntlIncome.
[2ndQtrTotal] = (([2ndQtrIncGrp])+([2ndQtrIncSales])+
([2ndQtrIncOther])),tQtrRptIntlIncome.[3rdQtrTotal] =
(([3rdQtrIncGrp])+([3rdQtrIncSales])+
([3rdQtrIncOther])),tQtrRptIntlIncome.[4thQtrTotal] =
(([4thQtrIncGrp])+([4thQtrIncSales])+
([4thQtrIncOther])),tQtrRptIntlIncome.YTDTithe =
(([1stQtrTithe])+([2ndQtrTithe])+([3rdQtrTithe])+
([4thQtrTithe])) Where Country=" + "'" + TempValue + "'"
DoCmd.OpenStoredProcedure "Qupd-
tQtrIncomeIntlYTDTotal", acViewNormal, acEdit
DoCmd.OpenStoredProcedure "Qupd-tQtrLdrshipIntl",
acViewNormal, acEdit
End Sub

.....TempValue is always blank(="").
Anybody knows why?
Thanks
.


.
 
Back
Top