filling a text box from a combo - another problem

rsfnoam

Registered User.
Local time
Today, 05:43
Joined
Aug 31, 2011
Messages
25
Hi again
As usual this forum is just great and again i thank all in advance.
I have another problem with my combos.I am working on the spreadsheet view.
The combo: quest2res1list
the lookup table:tozaot
the columns displaying in the combo:kod(long),result(string)
the text box to fill: schisans
The combo displays two colmns from the lookup table I need to search:kod, result
in the text box to fill Ineed the second column (result) of the user's selection
I tried the following code but what I recieve is that it changes that field for all the rows:
If Me!quest2res1list.Value = 1 Then
Me!quest2res1 = Null
' Me!quest2res1ans = 0

Else
Me!quest2res1 = Me!quest2res1list.Value
Set dbs = Application.CurrentDb
msearch = Me!quest2res1list.Value
Set rss = dbs.OpenRecordset("SELECT kod, result FROM tozaot where kod= " & msearch)
Me!schisans = rss!result
End If
Can someone help with that.. i know it's "that simple " but from one example I can learn .(-:
Thanx alot
Noam
 
Ditch the lookup for starters

So for clarity, you want the string to appear in the text box?
 
hi
I did that.
yes I want the string to appear in the text box..but only for the record(line) i am working on. what it does at the moment is displaying the string for all the records after I select a value in the combo.
 
are you familiar with cascading combo's?

What is the source for your combo's? Sounds like it may be the table?????

Tried using a query as the source of the combo?
 
Hi rodmc
probably not or maybe or I am confused if you could help with that
What bothers me is that in another application I did the same and there it worked.
Thanx alot in advance
Noam
 
create a query that lists what you want in your combo using a where clause to filter your records, in the where clause refer to the field that is the ID number of the record you want to update/change, you can do this by referring to the control of your form that holds the id
 
hi rodmc
I've done exacly what you suggested..with many thanx
and on the after update of the combo it does it. but the string(the text box to fill: schisans
) that is supposed to get the information from the column(2) (i.e. result in the tozaot table ) is showing on every row ..thaT what's bothering me.on another application with the same technology it did run..
Noam
 
if your relations are correct it shouldnt update every record, only the one that your are running the filter on.
Are both schemas identical?
 
...but what I recieve is that it changes that field for all the rows
Your problem has nothing to do with the Combobox! The problem is that the Textbox you're displaying the data in is not Bound to a Field in the underlying Table or Query!

Unbound Controls on a Datasheet View Form (what you are incorrectly calling 'spreadsheet view') always show the Value for the Current Record in all Records! You need to bind the Textbox to a Field in the underlying Record Source.

Linq ;0)>
 
ouch..
Now I understand..that text box schisans is not really bound to a field..
So I have actually to create a query referring to the tozaot table. i.e. in the record source refer to that query column 2(result) is that correct ?
hmm. I thought that was simple and it is (-:
many Thanx
Noam
 
So I have actually to create a query referring to the tozaot table.
You simply have to Bind the schisans Textbox to a Field in the Record Source for your Form.

In Form Design View
  1. Select the Textbox
  2. Go to Properties - Data - Control Source
  3. Use the dropdown to select the Field in your Record Source that you want the data in the schisans Textbox saved to
Linq ;0)>
 
Hi rodmc
This is what i did. but I guess I have a little different problem..I have on the record data only the numeric value (to save amunt of storage I suppose that even you will not save text values) and I use the schisans just as a text box for displaying the information for the users..
For explanation: if quest2res1 = 2 the user can't remember what the value is so i created the schisans ofn the form just as a readonly field to display the text in that case if quest2res1 = 2 the text in schisans will display "positive".. The user can't update that and of course i don't save it it supposed to be changed only when the users select from the combo..Sorry for the misunderstanding
Noam
 

Users who are viewing this thread

Back
Top Bottom