Stumped - List from Query w/ Default from Query

AccessWhenNoSQL

New member
Local time
Today, 15:31
Joined
Sep 23, 2010
Messages
3
List from Query w/ Set List Item 'Default' from Query

SO I have a form with a list box labeled type...

Type: __________v

Drop down will be from a query on a table returning

TypeA
TypeB
TypeC

I also need a default value in 'Type' from a query on a table where getuser() is used as a where and thw return is type...

field user|type
user1|TypeA
user2|TypeB
user3| TypeC

The "type" needs to be default but the drop down also needs to list the types because type could manually be changed but its for convenience that the default populate on new records...

Can this be done and what is the syntax to have a query return a default value and keep the drop down list values available?

1oFx.jpg


1oFD.jpg


What happens now is the default shows like this when the form is opened:
1oFX.jpg


The Drop Down populates correctly:

1oG3.jpg


I need to have it fill in automatically with the "default type" of the getuser()

Thanks for any help!
 
Last edited:
Still stuck :(

I did find putting this in the default filed =[Type].[ItemData](0)

This will "default" (0) - 1st in list
(1) - 2nd item in list
(2) - 3rd item in list

What I need is a variable to replace the =[Type].[ItemData](var1)

so I can search getuser() type = 0 or 1 or 2 and the correct default will display...

How can this be done?
 
Ok... I am sure there's a better method but this worked:

Added "RankType" to my original table

field user|type ||RankType
user1|TypeA || 1
user1|TypeA || 2
user1|TypeA || 3
user2|TypeB || 1
user2|TypeB || 2
user2|TypeB || 3
user3| TypeC || 1
user3| TypeC || 2
user3| TypeC || 3

This allowed me to use a query to create, and order my "drop-down" list by getuser() in the form field 'type' and then set the default:

=[Type].[ItemData](0)

"(0)" is rank 1 Type :)

Dirty but works....

Positive outcome with this is with some users the drop-down list can be generated differently for each if needed...
 

Users who are viewing this thread

Back
Top Bottom