Copying Value of One field to the other (1 Viewer)

khwaja

Registered User.
Local time
Today, 18:59
Joined
Jun 13, 2003
Messages
254
Generally it is quite simple to schieve with the following code.

Me!PrevLocation = Forms![frmRefCase]![frmRefCaseSF].Form![RelocStore]

However, there is a little twist. The relocStore is actually a drop down with a bound field to a numerical number with 4 columns. I like to copy the rest of the infs in this field as it is visible to me. For example it is the store number as the bound field but I see it as 5556: Wentoworth.

Wondering if there is a way to achieve this?
 

mcalex

Registered User.
Local time
Today, 15:59
Joined
Jun 18, 2009
Messages
141
Can you use the Column property of the combo?

PrevLocVar = Forms![frmRefCase]![frmRefCaseSF].Form![RelocStore].Column("StoreNumberColumn") & " " & Forms![frmRefCase]![frmRefCaseSF].Form![RelocStore].Column("Suburb/shopNameColumn")

Me!PrevLocation = PrevLocVar

hth
mcalex
 

khwaja

Registered User.
Local time
Today, 18:59
Joined
Jun 13, 2003
Messages
254
Thanls a lot. I changed the code to the following after decalring a variable. Is that OK?

PrevLocvar = Forms![frmRefCase]![frmRefCaseSF].Form![RelocStore].Column("Location") & ":" & Forms![frmRefCase]![frmRefCaseSF].Form![RelocStore].Column("LocNo")

I am getting runtome error 13": Type mismatch. Is it because LocNo is a number?
 

missinglinq

AWF VIP
Local time
Today, 03:59
Joined
Jun 20, 2003
Messages
6,423
Yes, Column(X) requires an Integer for the X, pointing to the correct Column of the Combobox Row. And the Column Index is Zero-Based, so, from Left-to-Right, the Columns are 0, 1, 2, 3.

Linq ;0)>
 

khwaja

Registered User.
Local time
Today, 18:59
Joined
Jun 13, 2003
Messages
254
Thanks. So what would be the corresponding change in the statement.
 

mcalex

Registered User.
Local time
Today, 15:59
Joined
Jun 18, 2009
Messages
141
Sorry, shoulda been clearer there. My bad. Nice save, thanks linq :)

@khwaja: that depends on how the data is put into the combo, but generally, the bound column is 0 and the shown column is 1, so replace:

("LocNo")
with
(0)

and so on

hth
mcalex
 

khwaja

Registered User.
Local time
Today, 18:59
Joined
Jun 13, 2003
Messages
254
Thanks. Tried the following statement. Still Type 13 error.

PrevLocvar = Forms![frmRefCase]![frmRefCaseSF].Form![RelocStore].Column("Location") & ":" & Forms![frmRefCase]![frmRefCaseSF].Form![RelocStore].Column(0)

I have column count 4, column widths as 0cm;5cm;1.505cm;1.752cm and bound column is 0 (which is storeID).
 

Users who are viewing this thread

Top Bottom