Synchronizing main form record with pop-up form record

Synchronizing main form record with pop-up form record

Post by Kath » Fri, 20 Feb 2004 05:05:37


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.
 
 
 

Synchronizing main form record with pop-up form record

Post by SG93YXJkIE » Fri, 20 Feb 2004 07:21:09

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




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

 
 
 

Synchronizing main form record with pop-up form record

Post by Kathy Rate » Fri, 20 Feb 2004 11:27:15

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
set it to open to a new record
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).
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:

to look
the
command
opens
lsit of
is
is
list,
record
record
for