VPK_Access
Registered User.
- Local time
- Tomorrow, 02:05
- Joined
- May 15, 2011
- Messages
- 36
Hi,
I have been struggling with the below code for many hours. Could anyone help me on this!
In my form I have a dropdown, which shows values - "A and B and C"
-"B"
-"C"
Depending on the value selected from the drop down I set a value in a text box and pass that value to my query. Now the problem is when I select the first value "A and B and C", I need to pass value to the query to retrieve value where the values can be "A or B or C".
In my query if I directly paste the value "A" or "B or "C"............it is working fine. However if I send the same value through a text box it doesnt give any output. I searched the net and in some sites they were telling to input a single code to enclose the string, stilll the problem is not solved. I have posted the code below. Any help would be really appreciated.
*********************************************
Private Sub StatsRDD_AfterUpdate()
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Dim Str4 As String
Str1 = """"
Str2 = " Or "
Str4 = "'"
Str3 = Str4 + Str1 + "A" + Str1 + Str2 + Str1 + "B" + Str1 + Str2 + Str1 + "C" + Str1 + Str4
Forms!OpeningForm![StatsRDD] = ""
If Forms!OpeningForm![StatsRDD] = "A and B and C" Then
Forms!OpeningForm![StatsRDD-Name] = Str3
ElseIf Forms!OpeningForm![StatsRDD] = "A" Then
Forms!OpeningForm![StatsRDD-Name] = "A"
ElseIf Forms!OpeningForm![StatsRDD] = "B" Then
Forms!OpeningForm![StatsRDD-Name] = "B"
End If
End Sub
And in my query I am selecting the value based on what is apssed in the text box 'Forms!OpeningForm![StatsRDD-BankName]'.
I have been struggling with the below code for many hours. Could anyone help me on this!
In my form I have a dropdown, which shows values - "A and B and C"
-"B"
-"C"
Depending on the value selected from the drop down I set a value in a text box and pass that value to my query. Now the problem is when I select the first value "A and B and C", I need to pass value to the query to retrieve value where the values can be "A or B or C".
In my query if I directly paste the value "A" or "B or "C"............it is working fine. However if I send the same value through a text box it doesnt give any output. I searched the net and in some sites they were telling to input a single code to enclose the string, stilll the problem is not solved. I have posted the code below. Any help would be really appreciated.
*********************************************
Private Sub StatsRDD_AfterUpdate()
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Dim Str4 As String
Str1 = """"
Str2 = " Or "
Str4 = "'"
Str3 = Str4 + Str1 + "A" + Str1 + Str2 + Str1 + "B" + Str1 + Str2 + Str1 + "C" + Str1 + Str4
Forms!OpeningForm![StatsRDD] = ""
If Forms!OpeningForm![StatsRDD] = "A and B and C" Then
Forms!OpeningForm![StatsRDD-Name] = Str3
ElseIf Forms!OpeningForm![StatsRDD] = "A" Then
Forms!OpeningForm![StatsRDD-Name] = "A"
ElseIf Forms!OpeningForm![StatsRDD] = "B" Then
Forms!OpeningForm![StatsRDD-Name] = "B"
End If
End Sub
And in my query I am selecting the value based on what is apssed in the text box 'Forms!OpeningForm![StatsRDD-BankName]'.