I have some code that uses a table called "Carts" from an Address database. and some of the addresses have units (like Unit A, Unit B, etc) and some doesn't. I need to be able to tell it to go ahead and select it if it doesn't have a unit. I am selecting the address from a list box. And when i choose one that does not have a unit it gives me the error "Field 'Carts.Unit' cannot be a zero-length string". Any help is greatly appreciated!
here is my code:
Private Sub lstAddress_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "New Service"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms![New Service].NUMBER.Value = Me.lstAddress.Column(0)
Forms![New Service].UNIT.Value = Me.lstAddress.Column(1)
Forms![New Service].STREETNAME.Value = Me.lstAddress.Column(2)
Forms![New Service].SUFFIX.Value = Me.lstAddress.Column(3)
Forms![New Service].QUADRANT.Value = Me.lstAddress.Column(4)
Forms![New Service].GBRoute.Value = Me.lstAddress.Column(5)
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
here is my code:
Private Sub lstAddress_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "New Service"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms![New Service].NUMBER.Value = Me.lstAddress.Column(0)
Forms![New Service].UNIT.Value = Me.lstAddress.Column(1)
Forms![New Service].STREETNAME.Value = Me.lstAddress.Column(2)
Forms![New Service].SUFFIX.Value = Me.lstAddress.Column(3)
Forms![New Service].QUADRANT.Value = Me.lstAddress.Column(4)
Forms![New Service].GBRoute.Value = Me.lstAddress.Column(5)
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub