Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query update a field

Status
Not open for further replies.

colkas

IS-IT--Management
Aug 26, 2003
39
SE
Hope someone can help

If we run a query and want a field to be filled in with another field (asuming the field is null) then what expression can we wrtire in a query so that the field is filled in with the alternative.

Example : Delivery address 1 as a name in
if it is null we want it to be filled in with customer name

Appreciate any help
 
WHAT????

Sam_F
"90% of the problem is asking the right question.
 
colkas, is it the general query syntax, you need, or the "option" function.

Nz(), is a built-in function within Access, that checks for nulls, & replaces with a value, dictated by user.

eg;
Dim sAddress As String, y As Integer
sAddress = Nz(Me.txtAddress, "Not Available")
or
sAddress = Nz(Me.txtAddress1, Me.txtAddress2)

y = Nz(Me.txtCost, 0)

So, you can try this...

SELECT Nz( tblCountries.txtCurrencyType, "Hello")
FROM tblCountries;

...Hello, replaces any Null values in txtCurrencyType

...or, in your case, with a different field...

SELECT Nz(tblCountries.txtCurrencyType,txtContinent) AS NewRec
FROM tblCountries;

...txtContinent, replaces any Null values in txtCurrencyType


Hope this helps, good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top