Edit Customer information

pwicr

Registered User.
Local time
, 20:36
Joined
Sep 22, 2011
Messages
144
I have a sales form that contains a combo box lookup to tblCUSTOMERS. It allows me to select a previous customer if that person is already entered into the system. If the person is NOT in the system, a form pops up to add the customer into the table.

What I need to know is, if the person IS already in the table BUT their address etc. has changed, what is the best way to get to that record to edit it? I'm THINKING a button with a command to go to that customer's profile.

Please help with the code to open a form to the customer selected in the drop down.

the customer name field is CUSTID:banghead:
 
Private Sub btnEDITCUSTOMER_Click()

On Error GoTo Err_btnEDITCUSTOMER_Click

Dim stLinkCriteria As String

If Me.Dirty Then Me.Dirty = False

stLinkCriteria = "[CUSTID] = " & Chr(34) & Me![CUSTID] & Chr(34)
DoCmd.OpenForm "frmADDCUSTOMER", acViewFORM, , stLinkCriteria

Err_btnEDITCUSTOMER_Click:

Exit_btnEDITCUSTOMER_Click:
Exit Sub

End Sub


Is what I have but it only opens the form blank. not to the current customer...
 
Last edited:
Is the [CUSTID] in the table a text value, (ID sounds for me as a number)?
If it is a number value, then
Code:
stLinkCriteria = "[CUSTID] = " & Me![CUSTID]
 
that didn't work. it won't even pop up the form now. grrr
 
It allows me to select a previous customer if that person is already entered into the system.
If you have a drop down (combobox) populated with Existing Customers, how do you identify a New Customer?
What specific steps do you do?
 
If it is a new customer, a pop-up comes up (similar form to the above mentioned) that comes up blank for adding a new customer.
 
Your code have to point to the combobox to get the customer ID, (remember to change "CustomerCombo" to the name you use for the combo box):

Code:
Private Sub Ctl_btnEDITCUSTOMER_Click()
  Dim stLinkCriteria As String

  stLinkCriteria = "[CUSTID] = " & Me.CustomerCombo
  DoCmd.OpenForm "frmADDCUSTOMER", acViewFORM, , stLinkCriteria
End Sub
 

Users who are viewing this thread

Back
Top Bottom