Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
TIM007
Starting Member
1 Post |
Posted - 2011-02-17 : 05:31:30
|
hi guys.m trying to create a system that automatically generate customer account. da account must begin with de first three letters of the customer's Last_Name nd end up with da last 5 digits incremented by 1 every time de new customer is added into da system (eg for Smith 'SMI00001',for Smiley 'SMI00002'.nd for Jackson 'JAC00001').i have da code frm da internet nd cnt figure out how to how nd where to put it in my .netASP C# code and SQL.m using SQL server database tables. M NEWBIE Me.Dirty = False If Me.NewRecord ThenDim strWhere As StringDim varResult As VariantstrWhere = "CUST_ACC_NO Like """ & Left(Me.CUST_NAME, 1) & "*"""varResult = DMax("CUST_ACC_NO", "tblCusAcc", strWhere)If IsNull(varResult) ThenMe.CUST_ACC_NO = Left(Me.CUST_NAME, 1) & "-001"ElseMe.CUST_ACC_NO = Left(varResult, 2) & _Format(Val(Right(varResult, 3)) + 1, "000")End IfMe.RefreshEnd Ifda system must generate da account automatically on ADD_Button click.PLEASE HELP!  |
|
|
|
|
|