assigning an integer using Null Value (1 Viewer)

kobiashi

Registered User.
Local time
Today, 10:44
Joined
May 11, 2018
Messages
258
hi

i have a query see below

Code:
SELECT Table_Bogies.Bogie_ID, Table_Bogies.BogieSerialNumber, Table_Bogies.BogieShortName, Table_Bogies.bogieType_IDFK, Table_Manufacturers.ManufacturerName, Table_Bogies_M2M.Stores_IDFK, Table_Bogies_M2M.DateAdded, Table_Stores.Location
FROM Table_Vehicles RIGHT JOIN (Table_Stores RIGHT JOIN (((Table_Manufacturers RIGHT JOIN Table_AssetComponentType ON Table_Manufacturers.Manufacturer_ID = Table_AssetComponentType.Manufacturer_IDFK) RIGHT JOIN Table_Bogies ON Table_AssetComponentType.AssetCompType_ID = Table_Bogies.bogieType_IDFK) RIGHT JOIN Table_Bogies_M2M ON Table_Bogies.Bogie_ID = Table_Bogies_M2M.Bogie_IDFK) ON Table_Stores.Stores_ID = Table_Bogies_M2M.Stores_IDFK) ON Table_Vehicles.Vehicle_ID = Table_Bogies_M2M.Vehicle_IDFK;


i am trying to insert a default value into Stores_IDFK as an integer, so the Table_Stores.Location self populates, as you can see, the stores_IDFK is the foreign key linked to Table_stores by a right join

when i use the NZ command in SQL on Stores_IDFK, it inserts "1", but the location field doesnt update, but when i manually populate Stores_IDFK with "1", it does, am i using the NZ command wrong?
 

RuralGuy

AWF VIP
Local time
Today, 04:44
Joined
Jul 2, 2005
Messages
13,826
The Nz() function does not change a field, it just changes what is returned from that field if the field is Null.
 

kobiashi

Registered User.
Local time
Today, 10:44
Joined
May 11, 2018
Messages
258
thanks for the reply,


is there a way of auto filling a field from the query?
 

RuralGuy

AWF VIP
Local time
Today, 04:44
Joined
Jul 2, 2005
Messages
13,826
To change a field in a table with a query requires either an update query or an append query. You are using a read type query (Select). Maybe if you describe what you are trying to accomplish (without using any jargon we won't understand) someone could offer another approach that would work for you.
 

kobiashi

Registered User.
Local time
Today, 10:44
Joined
May 11, 2018
Messages
258
Thanks for the reply, I e done it from the form instead.

Sent from my ONEPLUS A6003 using Tapatalk
 

RuralGuy

AWF VIP
Local time
Today, 04:44
Joined
Jul 2, 2005
Messages
13,826
Excellent decision! Thanks for the feedback. Did you use the thread tools at the top of the thread to mark this thread as Solved?
 

Users who are viewing this thread

Top Bottom