G
Guest
Hi, I am very new to access, so please bear with me. I have an order entry
form with a combo box for customer ID. It displays the company name, but it
is the custID that is bound to the table. What I want to do, is double click
on this field to open up the customer maintenance form, so that the company
info can be modified (or new account added) and then return to the order
entry form with the new information. It is this last piece that I am having
a problem with.
On the double click event of the combo box, I open the customer maintenance
form .
gstrCallingForm = Me.Name
gstrFieldName = "cboDlvCustID"
stDocName = "frmCustomerMaintenance"
stLinkCriteria = "[CustID]=" & Me![cboDlvCustID]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
On the close event of the customer maintenance form I have the following
If mstrCallingForm = "frmOrderHeader" Then
If mstrFieldName = "cboPUCustID" Then
Forms!frmOrderHeader.cboPUCustID.SetFocus
Forms!frmOrderHeader.cboPUCustID.Text = [Company]
End If
If mstrFieldName = "cboDlvCustID" Then
Forms!frmOrderHeader.cboDlvCustID.SetFocus
Forms!frmOrderHeader!cboDlvCustID.Text = [Company]
End If
This seems to work fine as long as I don’t have multiple accounts with the
same Company (which is the name). I really want to use CustID but when I
tried that instead of company I got a not in list error because it was
putting the account number in the combo box which displays the name.
I tried cboDLVCustID.ItemData(0) = [Custid] but I got errors on this too.
There must be a way to do this but I can’t seem to get the right keywords etc.
Any help would be truly appreciated.
Thanks
form with a combo box for customer ID. It displays the company name, but it
is the custID that is bound to the table. What I want to do, is double click
on this field to open up the customer maintenance form, so that the company
info can be modified (or new account added) and then return to the order
entry form with the new information. It is this last piece that I am having
a problem with.
On the double click event of the combo box, I open the customer maintenance
form .
gstrCallingForm = Me.Name
gstrFieldName = "cboDlvCustID"
stDocName = "frmCustomerMaintenance"
stLinkCriteria = "[CustID]=" & Me![cboDlvCustID]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
On the close event of the customer maintenance form I have the following
If mstrCallingForm = "frmOrderHeader" Then
If mstrFieldName = "cboPUCustID" Then
Forms!frmOrderHeader.cboPUCustID.SetFocus
Forms!frmOrderHeader.cboPUCustID.Text = [Company]
End If
If mstrFieldName = "cboDlvCustID" Then
Forms!frmOrderHeader.cboDlvCustID.SetFocus
Forms!frmOrderHeader!cboDlvCustID.Text = [Company]
End If
This seems to work fine as long as I don’t have multiple accounts with the
same Company (which is the name). I really want to use CustID but when I
tried that instead of company I got a not in list error because it was
putting the account number in the combo box which displays the name.
I tried cboDLVCustID.ItemData(0) = [Custid] but I got errors on this too.
There must be a way to do this but I can’t seem to get the right keywords etc.
Any help would be truly appreciated.
Thanks