|
-
Oct 19th, 2000, 11:29 AM
#1
Thread Starter
Hyperactive Member
Hi,
On my form I have:
Data1 control hooked up to an Access Database, a ComboBox control and a TextBox control
In that Database I have a table 'Prices-SoftDrinks' with 2 fields, Volume & Price:
Volume...Price
0.3L........0.75
0.5L........0.90
1L..........1.29
2L..........1.99
I read 'Volume' values in a ComboBox.
I want to be able to select one of the values from the ComboBox ('Volume' field) and get the corresponding price from 'Price' field from database. Then display the corresponding Price in a Text1 textbox.
I tried the following:
Data1.RecordSource = "prices-softdrinks"
Data1.Refresh
Data1.RecordSet.FindFirst "Volume = ComboBox.Text"
Text1.Text = Data1.Recordset.Fields("Price").Value
...but doesn't work, although the following works if I use '0.5L' instead of ComboBox.Text...
Data1.RecordSource = "prices-softdrinks"
Data1.Refresh
Data1.RecordSet.FindFirst "Volume = '0.5L'"
Text1.Text = Data1.Recordset.Fields("Price").Value
...however I don't want to hardwire the values, but select them from ComboBox
Please help!
-
Oct 19th, 2000, 11:41 AM
#2
Frenzied Member
Try:
Data1.RecordSource = "prices-softdrinks"
Data1.Refresh
Data1.RecordSet.FindFirst "Volume = '" & ComboBox.Text & "'"
Text1.Text = Data1.Recordset.Fields("Price").Value
-
Oct 19th, 2000, 12:02 PM
#3
Thread Starter
Hyperactive Member
Thank you Sebs, It works great!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|