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!

cannot be zero lehgth string error please help

Status
Not open for further replies.

Shadez

Programmer
Jul 5, 2001
57
US
I am trying to pull info from the main form to the subform. I am currently getting the above error please help !!!!

this is code as is

Private Sub Command26_Click()
Me![frmBMembers].Form![BName] = Me!name
Me![frmBMembers].Form![BCompany] = Me!company
Me![frmBMembers].Form![BAddress1] = Me!address1
Me![frmBMembers].Form![BAddress2] = Me!address2
Me![frmBMembers].Form![BCity] = Me!city
Me![frmBMembers].Form![BState] = Me!state
Me![frmBMembers].Form![BZipcode] = Me!zip
Me![frmBMembers].Form![BPhone] = Me!phone
Me![frmBMembers].Form![BFax] = Me!fax
Me![frmBMembers].Form![BEmail] = Me!email
Me.Refresh
End Sub

I tried ot add a conditional statement like

If Not IsNull(Me!address2) Then

It still kicked back this error though. As long as the field contains data I have np. P
 
Hi!

Try enclosing in this conditional statement:

If Nz(Len(Me!address2),0) <> 0 Then etc.

You may want to enclose the rest of your text fields in a similar fashion just to avoid the same problem.

hth
Jeff Bridgham
 
This should also work:
Me![frmBMembers].Form![BName] = nz(Me!name,&quot;&quot;)
Me![frmBMembers].Form![BCompany] = nz(Me!company,&quot;&quot;)
Me![frmBMembers].Form![BAddress1] = nz(Me!address1,&quot;&quot;)
Me![frmBMembers].Form![BAddress2] = nz(Me!address2,&quot;&quot;)
Etc.
Etc.
 
or in the design of the table, change the field so it will allow zero length strings.

Also, wouldn't:
Me![frmBMembers].Form![BName] = nz(Me!name,&quot;&quot;)
still produce the same error, as &quot;&quot; is still an empty string. Wouldn't it be:
Me![frmBMembers].Form![BName] = nz(Me!name,null)

I am probably talking nonsense though.

Nick
 
thanks for all the advice. jebry your sttement seemed to do the trick. I did try the others but was still getting the error. Once again thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top