DoCmd.SetProperty with NULL value

triplee23

Newbie MS Access user
Local time
Today, 07:43
Joined
Apr 2, 2010
Messages
17
Hi,

I had a simple command button with an embedded macro object. The macro simply copied a value from one textbox to the other on the same form.

The macro was simple using the SetProperty function and worked without issues.

I then transfered the macro to VBA automatically and the result was:

DoCmd.SetProperty in VBA, DoCmd.SetProperty "txtbox1", acPropertyValue, txtbox2

This works perfert if txtbox1 has a value. If it s NULL I get the error message that the data format is wrong. As an embedded macro it works fine even if the txtbox was NULL.

Can anyone help me make this work even if the value of txtbox1 = NULL?

Thanks!
 
Why not use a more simple solution for that?

Code:
Me.TextControl2=Me.TextControl1
 
Drop the Docmd and in the OnClick event of the button, insert in the VBA module
Me.txtbox1 = Me.txtbox2
 

Users who are viewing this thread

Back
Top Bottom