Deriving Default Values from Table

Naka

Registered User.
Local time
Today, 09:49
Joined
Jul 27, 2007
Messages
24
i was wondering if there was a away to set a default value for one of the fields in a form that is taken from a table. for example, i have a form w/ 3 fields: plate#, logoname, and prints. i want it so that when i type in a plate#, the logoname automatically pops out whenever a corresponding plate# is associated w/ a specific logoname because the field "plate#" is my primary key in another field so its unique. any and all help is appreciated, thanks


oh im using access 2003 btw
 
Last edited:
Do you want this default value to be dynamic or to be set once?
If you want to set it once: open the table in design mode and change it or use ADOX to do this with code.

A dynamic default value is a variable which you can retrieve from the "Defaults" table which you have to make.

:D
 
actually either would be fine...i dont have THAT many entries to be turned into a default entry..like 1000, i could just append them into a table. so you could just explain whichever method you feel is best. thanks
 
i dont get it..:confused:

could i maybe get a step-by-step, but brief instruction on what to do?
 
open the table in design mode

then

select the field of which you want to change the default value

then

do it

then

save it

:D
 
ill try..but im kinda slow w/ this kinda stuff...

so lemme get it straight,

first, you want me to create a default value table consisting of only 2 fields, the plate# and the logoname. then you want me to go change the default value in my form to something like [defaultvalues]![logoname], and thus magic will happen and when i go into my form and say, type in a plate#, a corresponding logoname should appear int he logoname field?
 
No.

Your question:
to set a default value for one of the fields in a form that is taken from a table.
Lets call this table: Table1. Now do the following:
open Table1 in design mode

then

select the field of which you want to change the default value

then

do it

then

save it
 
ok..i got up to the "do it" part. what exactly does "do it" mean??:confused:
 
He means change the default value!!!
 
you wanted to set the default value. so doit, change or set the default value.
 
maybe ive said something wrong and its being misinterpreted. lemme try saying it again. when i say default value, i mean like a value that comes up and you dont need to type anything in that field. but i dont want just ONE default value for that field, i have like a 1000 default values i would like to set in that field. and to obtain that default value, i have 1000 corresponding reference numbers (called plate# on my table), that hopefully, when i type in one plate#, i get a default value of the corresponding logoname, and when i type in a different plate#, i get the default value of the corresponding logoname to said plate#. i hope thats a little clearer, thanks
 
you can't set 1000 defaults for one field.
perhaps you should use a combobox. instead of a textbox.
Still, setting the default value for a field in a table is not a bad thing. When you don't input any value in this field when inserting a record, this default value will be used.

you're welcome
 
what you want is a table , a qry and a combo box

right in your table you need
plateref
and logoname
these should be fields in your table (and alos an idnumber

now tie a qry to this table first field plate, then logo

now save qry as xxxxx(name that means something to you)
now in your main underlying table you need to have at (for the purest they will have a fit at this point) these two fields avaibale plateref and logo

now add a comboboxz to your form based on the qry
in the afterupdate properties
have
the name of your field where you want the plateref stored call zzz (change this to the right name)

zzzz = comboboxname.coloum(0)
next field
which will be the logofield (called wwww)
wwww = comboboxname.coloum(1)

then me.refresh


right Access has a minor irritation that it starts counting from 0 and not 1 so the first field in your qry/comob box will be 0 and the second will be 1

this might sould a little weird but works - if this is still a problem I will zip up a demo version of this in Access 2000
 
ah, i see.

can i get that zipped file? thanks
 
its at home - it'll be about 2 hours time -

g
 
sorry later than I thought (Daughter need a bath..)
any way

I lost my other sample - duh..
made a quickie for you

right you need a table of products (plates - with logo as another field ont he table)
now you need a qry to list these -qry and forms(and reports) work better than basing these on tables alone (personal opion)

now a comb box on this qry
and a little tweak ont he after update properties

the samepl i have put together is very sloppy but it has the core element
1 main table
2 product table
a form
a comob box

have a look and if you need any answers let us know

g
 

Attachments

thanks a ton. im gonna work on it right away...although work ends in 15 minutes :P
 
well its 9oclock here - if you get stuck shout..
 

Users who are viewing this thread

Back
Top Bottom