|
-
Dec 14th, 2009, 03:41 AM
#1
Thread Starter
Fanatic Member
MS access 2003- update null fields
Hi,
I'm trying to update an unbound form fields back into the table using a recordset.
I'm having troubles with Null values.
Here's the code:
rst!Field1= nz(me.field1,Null)
- However, this seems to fail no matter what I put for the nz null value.
The only thing that seems to work is pretty clumsy:
If Nz(Me.Field1, "") = "" Then
rst!Field1 = Null
Else
rst!Field1 = Me.Field1
End If
Any other suggestions?
Thanks,
-
Dec 15th, 2009, 08:21 PM
#2
Fanatic Member
Re: MS access 2003- update null fields
What is "Nz" is that a custom function or a function I have never seen before?
What errors are you getting, or what is it doing that your not sure why?
Can this "Nz" function accept Null parameters?
-
Dec 16th, 2009, 12:57 AM
#3
Addicted Member
Re: MS access 2003- update null fields
Nz lets you return a value when a variant is null
-
Dec 16th, 2009, 05:52 AM
#4
Thread Starter
Fanatic Member
Re: MS access 2003- update null fields
So, any ideas about this?
-
Dec 21st, 2009, 07:52 PM
#5
Fanatic Member
Re: MS access 2003- update null fields
rst!Field1= nz(me.field1,Null)
So am I reading this right?
If me.field1 Is Null Then Null Else Me.Field1
......
So I take it the field is not true Null it is "", but you want it to be loaded with Null if "". So your Nz is not returning Null back on your first line because it is "", Not Null.
Do you have field restrictions that are preventing it from being assigned ""?
-
Dec 22nd, 2009, 02:13 AM
#6
Thread Starter
Fanatic Member
Re: MS access 2003- update null fields
Hi,
I'm not sure I understand the question but it is an unbound form, and the DB is mySQL.
Thanks
-
Dec 22nd, 2009, 08:33 AM
#7
Re: MS access 2003- update null fields
Try this
Code:
Dim varFld
varFld = Me.Field1
rst!Field1= nz(varFld,Null)
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|