Hi Guys,
I have an Access form with a command button that will copy certain fields to the next record to be entered. The code for that button is:
I have a problem with copying the field titled Notes. All the other ones being copied over are required to have data, therefore copying them to the next record is no problem. Because there aren't always notes, when the button is clicked and there are not notes, I get an error stating "Field 'tbl_Blotter.Notes' cannot be a zero-length string." Is there a way I can make my code copy it if it's there, but not if it isn't?
PS- I know some of my naming of fields and controls is bad form, but this is just an experiment at the moment. If I decide to include it in the real database, I will fix them.
Thanks!
I have an Access form with a command button that will copy certain fields to the next record to be entered. The code for that button is:
Code:
Private Sub Command367_Click()
Me.BuySell.DefaultValue = "=" & Chr(34) & Me!BuySell.Value & Chr(34)
Me.TradeDate.DefaultValue = "=" & Chr(34) & Me!TradeDate.Value & Chr(34)
Me.SettlementDate.DefaultValue = "=" & Chr(34) & Me!SettlementDate.Value & Chr(34)
Me.CUSIPSymbol.DefaultValue = "=" & Chr(34) & Me!CUSIPSymbol.Value & Chr(34)
Me.SecurityDescription.DefaultValue = "=" & Chr(34) & Me!SecurityDescription.Value & Chr(34)
Me.Combo332.DefaultValue = "=" & Chr(34) & Me!Combo332.Value & Chr(34)
Me.Text362.DefaultValue = "=" & Chr(34) & Me!Text362.Value & Chr(34)
Me.Notes.DefaultValue = "=" & Chr(34) & Me!Notes.Value & Chr(34)
DoCmd.GoToRecord , , acNext
DoCmd.GoToControl "Account#"
End Sub
I have a problem with copying the field titled Notes. All the other ones being copied over are required to have data, therefore copying them to the next record is no problem. Because there aren't always notes, when the button is clicked and there are not notes, I get an error stating "Field 'tbl_Blotter.Notes' cannot be a zero-length string." Is there a way I can make my code copy it if it's there, but not if it isn't?
PS- I know some of my naming of fields and controls is bad form, but this is just an experiment at the moment. If I decide to include it in the real database, I will fix them.
Thanks!