Default Value >> memo from other table

Cameroncha

Registered User.
Local time
Today, 09:39
Joined
Jul 1, 2002
Messages
58
is there a way to make a default value the value of a single "Cell" Either from an Excel sheet or an existing memo field in an Access table. If so how would i go about doing this.

Thanks.
 
would i have to place that code into the query directly... or can i reference it remotly >>> Could I pull from a cell in an excel sheet or existing access tables cell.

I have run into import problems with memo fields from excel (255 character limit) so i would like to avoid this approach.
 
We have a concept problem in the original question.

A default value is a static value appearing in a TableDef in a database.

You could easily do a cut-and-paste in order to define the default value. But it is still static. The cell or memo field you mention as your desired source is not static. So at best, that would have given you a "snapshot" of the cell/field.

The lookup can certainly be in a query.

You can link to a spreadsheet, making it look like a table for at least some purposes. The 255-character limit would still apply, though. You could also pull from a field in another table.

If you have a table or a spreadsheet-in-table's-clothing, you can use DLookup in combination with some other test.

For example, if your condition for applying this default value was that the field in question was null or empty, the expression MIGHT look like

Iif( Len( Nz( [MyField], "") ) = 0, DLookup( "[MyDefault]", "MyOtherTable", insert selection criteria here, [MyField] )

which is perfectly legal in queries or forms or reports.
(At least, it is legal if I got the parentheses right and you put in a good set of selection criteria.)
 
Thanks for the advice... this is a definate step in the direction of my problem. Sorry, sometimes my text is rather cryptic.

You are right I have a table that is static, 1 row.
I want to pull values from specific columns from the single row.

The Query that i am pulling the information to is Dynamic.
Thanks.

I will try to tackle the code <<< dont really know VB well >>>

would i simply replace insert selection criteria here with the name of the table and the name of the column that i am pulling the data from?

:)
 
"You are right I have a table that is static, 1 row.
I want to pull values from specific columns from the single row."

Well, in that case, you can leave off the criteria completely and just name the correct field-name.

A selection criterion narrows you down to 1 row. But you only HAVE one row, so no problem there! The "selection criterion" is an option in a DLookup. But you could probably also get by with DFirst in that case. (Or a DLast, just to be contrary.)
 

Users who are viewing this thread

Back
Top Bottom