Synchronizing main form record with pop-up form record

  • Thread starter Thread starter Kathy
  • Start date Start date
K

Kathy

On my main form, I have a pop-up search dialog box to look
for names of customers who may already be entered in the
database. Once I open the pop-up form using a command
button, I enter the last name and my customers form opens
in datasheet view, listing any last names that match
(might be more than one same name). I look at the lsit of
customers and decide if the customer I want to enter is
already in the list (additional info on pop-up form is
first name and customer number). If they are in the list,
I would like to be able to click on that particular record
and have the current record of the main form be the record
for that customer. Can anyone help me with the code for
this? Thanks.
 
I would eliminate the pop-up box completely

Bind your form to your customer table (tblCustomers) and set it to open to a new recor

Private Sub Form_Open(
DoCmd.GoToRecord acDataForm, Me.Name, acNewRe
End Su

Use a ComboBox on your form (cboCustomer) and have it pull the customer names from your customer table. Set the AutoFill and LimitToList properties for cboCustomer to Yes. (AutoFill's jsut convenient and LimitToList prevents miskeys)

The user can open the form and start typing or they can use cboCustomers to go to a specific record. In the AfterUpdate event of cboCustomer, if a customer has been selected, filter the form to show that customer. If no customer has been selected, don't do anything

Private Sub cboCustomer_AfterUpdate(

' if no customer has beens elected, end the su
If IsNull([cboCustomer]) or [cboCustomer] = "" The
Exit Su
End I

' otherwise..

' filter the form for the selected custome
Dim strCust As Strin
Dim strFilter As Strin

strCust = [cboCustomer
strFilter = "[CustomerFieldName] = '" & strCust & "'

DoCmd.ApplyFilter , strFilte

End Su

Hope this helps

Howard Brod


End Su


----- Kathy wrote: ----

On my main form, I have a pop-up search dialog box to look
for names of customers who may already be entered in the
database. Once I open the pop-up form using a command
button, I enter the last name and my customers form opens
in datasheet view, listing any last names that match
(might be more than one same name). I look at the lsit of
customers and decide if the customer I want to enter is
already in the list (additional info on pop-up form is
first name and customer number). If they are in the list,
I would like to be able to click on that particular record
and have the current record of the main form be the record
for that customer. Can anyone help me with the code for
this? Thanks
 
Howard,

Thanks for responding, but I am still having trouble. I'm
going to re-post the question and explain it a little
better. If you have an answer, I would love to hear from
you, but I'll re-post so others who may have an answer
will see it. See the new post for a better description of
my problem. Thanks again.

Kathy
-----Original Message-----
I would eliminate the pop-up box completely.

Bind your form to your customer table (tblCustomers) and set it to open to a new record

Private Sub Form_Open()
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
End Sub

Use a ComboBox on your form (cboCustomer) and have it
pull the customer names from your customer table. Set the
AutoFill and LimitToList properties for cboCustomer to
Yes. (AutoFill's jsut convenient and LimitToList prevents
miskeys).
The user can open the form and start typing or they can
use cboCustomers to go to a specific record. In the
AfterUpdate event of cboCustomer, if a customer has been
selected, filter the form to show that customer. If no
customer has been selected, don't do anything:
Private Sub cboCustomer_AfterUpdate()

' if no customer has beens elected, end the sub
If IsNull([cboCustomer]) or [cboCustomer] = "" Then
Exit Sub
End If

' otherwise...

' filter the form for the selected customer
Dim strCust As String
Dim strFilter As String

strCust = [cboCustomer]
strFilter = "[CustomerFieldName] = '" & strCust & "'"

DoCmd.ApplyFilter , strFilter

End Sub

Hope this helps!

Howard Brody


End Sub


----- Kathy wrote: -----

On my main form, I have a pop-up search dialog box to look
for names of customers who may already be entered in the
database. Once I open the pop-up form using a command
button, I enter the last name and my customers form opens
in datasheet view, listing any last names that match
(might be more than one same name). I look at the lsit of
customers and decide if the customer I want to enter is
already in the list (additional info on pop-up form is
first name and customer number). If they are in the list,
I would like to be able to click on that particular record
and have the current record of the main form be the record
for that customer. Can anyone help me with the code for
this? Thanks.

.
 
Back
Top