Connecting Tech Pros Worldwide Forums | Help | Site Map

Need help writing a double click event procedure

Uninvisible
Guest
 
Posts: n/a
#1: Nov 13 '05
I have put together a db for a law firm to keep track of counterfeit
activities. There are four parent tables:

tblContact
tblTransaction
tblAction
tblFile

I have created a form, frmNewMatter, for adding new records to the db.
The form is based on tblFile and has a subform based on tblContact,
tblTransaction and tblAction. Essentially, frmNewMatter allows one to
input a new file number and the subform allows one to associate a
contact, transaction and action taken information to that file. In the
Contact section of frmNewMatter, one can either enter new contact
information or type in the tblContact primary key (an auto-number) in
the ContactID field which auto populates the contact fields on the
form. Because the pk is random and because the contact information by
its nature is incomplete (one record may only have an e-mail address
while another just a company name), I needed to include a search on the
form to allow users to search records in tblContact to determine the pk
associated with the preexisting contact. To solve this, I placed a
button on the form which opens frmSearch, a form I downloaded that
generates dynamic SQL (to search tblContact in the db) and assigns it
to a listbox on the form to show the results. I now want to be able to
create a double click event procedure which allows a user to click on a
result from the search and auto populate the form. So, I need code
which will say that on double click, enter the pk from the tblContact
and insert it in the ContactID field on the open frmNewMatter, thereby
obviating the need for a user to remember the pk and inputting it
manually. Any suggestions on the coding?


Salad
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Need help writing a double click event procedure


Uninvisible wrote:[color=blue]
> I have put together a db for a law firm to keep track of counterfeit
> activities. There are four parent tables:
>
> tblContact
> tblTransaction
> tblAction
> tblFile
>
> I have created a form, frmNewMatter, for adding new records to the db.
> The form is based on tblFile and has a subform based on tblContact,
> tblTransaction and tblAction. Essentially, frmNewMatter allows one to
> input a new file number and the subform allows one to associate a
> contact, transaction and action taken information to that file. In the
> Contact section of frmNewMatter, one can either enter new contact
> information or type in the tblContact primary key (an auto-number) in
> the ContactID field which auto populates the contact fields on the
> form. Because the pk is random and because the contact information by
> its nature is incomplete (one record may only have an e-mail address
> while another just a company name), I needed to include a search on the
> form to allow users to search records in tblContact to determine the pk
> associated with the preexisting contact. To solve this, I placed a
> button on the form which opens frmSearch, a form I downloaded that
> generates dynamic SQL (to search tblContact in the db) and assigns it
> to a listbox on the form to show the results. I now want to be able to
> create a double click event procedure which allows a user to click on a
> result from the search and auto populate the form. So, I need code
> which will say that on double click, enter the pk from the tblContact
> and insert it in the ContactID field on the open frmNewMatter, thereby
> obviating the need for a user to remember the pk and inputting it
> manually. Any suggestions on the coding?
>[/color]
You can pass the key as an argument to a form. You can check for this
value in a manner like
If Not IsNull(Me.OpenArgs) Then

OpenArgs is a variant value.

See OpenForm for passing an arument. It is the last argument of OpenForm.

Also, you can refer to something like
Me.PKFieldName = Forms!SomeOpenForm!PKFieldName
John
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Need help writing a double click event procedure


What field do you want to search by. If every field has a name you just need
to put a combo box on frmNewmatter and bound it to ContactID in tblFile. The
combo box Wizard will do it for you .If you click combo box on tool bar and
draw the box where you want it. Select "I want combobox to look up value ina
table". Select tblContact from list. The fields from tblContact will
display. Select them all and it will show you them displayed with the
Primary key hidden. Leave it like this, even though it is the pk you are
looking for. Then select "store the value in this field" and select
ContactID ffrom the list and finish. You can search on whatever field is the
first field in the combobox query, (which you can modify as you please from
the combo rowsource property). As you type into the combo box it will look
through tblContact for a match in that field and when you select the name it
will automatically write the pk for that contact to ContactID on your form


John.

"Uninvisible" <ggdworkin@gmail.com> wrote in message
news:1125428167.472558.310970@g14g2000cwa.googlegr oups.com...[color=blue]
>I have put together a db for a law firm to keep track of counterfeit
> activities. There are four parent tables:
>
> tblContact
> tblTransaction
> tblAction
> tblFile
>
> I have created a form, frmNewMatter, for adding new records to the db.
> The form is based on tblFile and has a subform based on tblContact,
> tblTransaction and tblAction. Essentially, frmNewMatter allows one to
> input a new file number and the subform allows one to associate a
> contact, transaction and action taken information to that file. In the
> Contact section of frmNewMatter, one can either enter new contact
> information or type in the tblContact primary key (an auto-number) in
> the ContactID field which auto populates the contact fields on the
> form. Because the pk is random and because the contact information by
> its nature is incomplete (one record may only have an e-mail address
> while another just a company name), I needed to include a search on the
> form to allow users to search records in tblContact to determine the pk
> associated with the preexisting contact. To solve this, I placed a
> button on the form which opens frmSearch, a form I downloaded that
> generates dynamic SQL (to search tblContact in the db) and assigns it
> to a listbox on the form to show the results. I now want to be able to
> create a double click event procedure which allows a user to click on a
> result from the search and auto populate the form. So, I need code
> which will say that on double click, enter the pk from the tblContact
> and insert it in the ContactID field on the open frmNewMatter, thereby
> obviating the need for a user to remember the pk and inputting it
> manually. Any suggestions on the coding?
>[/color]


Closed Thread


Similar Microsoft Access / VBA bytes