bademployee
Board Regular
- Joined
- Aug 19, 2010
- Messages
- 184
Hi all
I have a form with 2 buttons to add new customers to our database;
The existing customers are selected by using a combo box linked to cell C9. I would like to be able to edit existing customer details by opening up the same sort of form, retrieving the customer details based on value in C9.
Any help would be appreciated.
Mark
I have a form with 2 buttons to add new customers to our database;
PHP:
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdsubmit_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Customer")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 12) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 3).Value = Me.postal1.Value
ws.Cells(iRow, 4).Value = Me.postal2.Value
ws.Cells(iRow, 5).Value = Me.txtstate.Value
ws.Cells(iRow, 6).Value = Me.postcode.Value
ws.Cells(iRow, 7).Value = Me.txtemail.Value
ws.Cells(iRow, 8).Value = Me.txtphone.Value
ws.Cells(iRow, 9).Value = Me.txtfax.Value
ws.Cells(iRow, 10).Value = Me.tradingname.Value
ws.Cells(iRow, 11).Value = Me.txtabn.Value
ws.Cells(iRow, 12).Value = Me.txtmobile.Value
ws.Cells(iRow, 13).Value = Me.contactname.Value
'clear the data
Me.postal1.Value = ""
Me.postal2.Value = ""
Me.txtstate.Value = ""
Me.postcode.Value = ""
Me.txtemail.Value = ""
Me.txtphone.Value = ""
Me.txtfax.Value = ""
Me.contactname.Value = ""
Me.txtabn.Value = ""
Me.txtmobile.Value = ""
Me.tradingname.Value = ""
Me.postal1.SetFocus
Unload Me
End Sub
Any help would be appreciated.
Mark