View Full Version : Dlookup v SetValue


crosmill
10-19-2001, 03:28 AM
I have two forms that are displayed at the same time. On one form I want to select a record form a combo box based on a lookup table. I then want the other form to display details form that record.
I tried changing the ID to a Dlookup, which returns the ID, but the rest of the form doesn't update to that record.
I tried using SetValue with OnClick to change the ID, but it tells me it can't do it. Could this be because the value I want to update is the ID for record?

It may be worth pointing out that the second form is based on a table which is based on a crosstab query, which is why I don't just have it as a subform.

If this doesn't make sense let me know!

[This message has been edited by crosmill (edited 10-19-2001).]

Rich
10-19-2001, 04:11 AM
You can use the method described here you can also use a subform based directly on a crosstab query. http://www.access-programmers.co.uk/ubb/Forum7/HTML/002286.html

crosmill
10-19-2001, 05:58 AM
I can use a subform based on a crosstab query? Why won't it let me! Every time I try to make one it just doesn't work.
It tells me I can't use pass-through query or non fixed-column crosstab as a subform.

The link you sent was (I think) for creating the list box and setting the click event to find a record. I've done this, the trouble is that it won't change the records ID (i'm using the SetValue function in a macro) it tells me 'I can't assign a value to this object' and that it may be read only. Looking at it I cannot change the ID from the form, I suspect this is probably the cause. However I don't know how to change this, the control is not locked.

Any ideas?