View Full Version : Solved: Would This Work
HI
Well I am using an IF statement to see if a combo box has a certain piece of text in it, however I am getting an error, and I am wondering if it only accepts values as thats the only propert it has, below is the code
Dim StoreSeasonCost As Integer
Select Case ComboUpdate
Case AccommodationType.Value = "Family ?100.00"
AcommodationPrice.SetFocus = True
AcommodationPrice.Text = DLookup("[AcommodationPrice]", "Accommodation Information", "AccommodationInfoID = 1")
StoreSeasonCost = 30
end Select
Just wondering if anyone can spot a syntax error or something with it, below is the error I am getting.
"The expression After Update you entered as the event propery setting produced the following error:Ambigyous name detected:Combo54_AfterUpdate
Help appreciated
Carl A
12-04-2007, 04:05 AM
HI
"The expression After Update you entered as the event propery setting produced the following error:Ambigyous name detected:Combo54_AfterUpdate
Help appreciated
Usually an error of that type suggest that there are two sub procedures with the same name.
mattj
12-04-2007, 06:22 AM
Wouldn't it be
Dim StoreSeasonCost As Integer
Select Case Me.AccomodationType
Case "Family ?100.00"
AcommodationPrice.SetFocus = True
AcommodationPrice.Text = DLookup("[AcommodationPrice]", "Accommodation Information", "AccommodationInfoID = 1")
StoreSeasonCost = 30
End Select
Hi Thanks for your help
Right I have used the code above, mabe changed in slightly just to experiment due to I still cannot get it to work, although it could be my lack of knowledge that is causing the problem
[Private Sub Combo85_keypress()
Dim StoreSeasonCost As Integer
Dim StoreFamily As Currency
Select Case Me.Combo85
Case "Family"
'AcommodationPrice.SetFocus = True
StoreFamily = DLookup("[AccommodationPrice]", "Accommodation Information", "AccommodationInfoID = 1")
'AcommodationPrice.Text = DLookup("[PremiumViewPercentage]", "Accommodation Information", "AccommodationInfoID = 1")
AcommodationPrice.Text = StoreFamily
'StoreSeasonCost = 30
End Select
End Sub
I get no error message with this code, however I think the main problem is its just not brining the value back to the form, i have check everything 5x times.
mattj
12-05-2007, 09:35 AM
Take off the text reference:
AcommodationPrice = StoreFamily
So Like this:
Private Sub Combo85_keypress()
Dim StoreSeasonCost As Integer
Dim StoreFamily As Currency
Select Case Me.Combo85
Case "Family"
'AcommodationPrice.SetFocus = True
'StoreFamily = DLookup("[AccommodationPrice]", "Accommodation Information", "AccommodationInfoID = 1")
AcommodationPrice.Text = DLookup("[PremiumViewPercentage]", "Accommodation Information", "AccommodationInfoID = 1")
' AcommodationPrice.Text = StoreFamily
'StoreSeasonCost = 30
End Select
End Sub
However still nothing happens, and no error occurs :(
OTWarrior
12-06-2007, 01:55 AM
is your table/qry actually called "Accommodation Information", or am i missing something here?
mattj
12-06-2007, 01:44 PM
No, like this:
Select Case Me.Combo85
Case "Family"
StoreFamily = DLookup("[AccommodationPrice]", "Accommodation Information", "AccommodationInfoID = 1")
AcommodationPrice = StoreFamily
There were about 4 errors with it to be honest, anyway it was due to textbox being bound to fields and the same with the combo box, its all working now anyway, thanks for your help.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.