Answer for Tammy (code)

G

Guest

Hi Tammy

Sorry for the late reply -
Hi Wayne - I have tried it and it just does not work. I created the
cboSearch and subform on a form titled "Issues" created from the "Issues"
table. Is that the problem? Or, would you mind terribly if I were to email
or call you? My yahoo email is (e-mail address removed) - thanks for anything
you could do.

I don’t give out my phone number on the internet sorry. Can I suggest you
don’t post your e mail address.

If there is still a problem with the code just repost to this forum as there
are many many people on here who are much more expert than I am and they will
be able to help if you’re still having problems.


Have you followed the post “exactly†if you have, please let me know what
the problem is and I’ll look at it again.

Create an unbound combo box on your main form call this new combo [cboSearch]

I have assumed that you have a table called tblCustomerDetails
I have assumed that you have fields called
CustomerID
Customer1stName
CustomerSurname

ComboBox (Name = cboSearch)
Row Source Type Table/Query
Row Source
SELECT [tblCustomerDetails].[ CustomerID], [tblCustomerDetails ].[
Customer1stName], [tblCustomerDetails ].[ CustomerSurname] FROM
[tblCustomerDetails ];

Column Count 3
Column widths 0cm;2.542cm;2.542cm


Set the AfterUpdate like this

Private Sub cboSearch_AfterUpdate()
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CustomerID] = " & Str(Nz(Me![cboSearch], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


This will take you to the record you want

Next – your subform
You MUST have the [CustomerID] in both the main form and the sub form. You
can set the visible to NO if you don’t want to show it but it will still be
there.

Set the Data Column of the properties box on the subform like this
Source Object tblCustomerDetails
Link Child Field CustomerID
Link Master Field CustomerID
Enabled Yes
Locked No

Insert the fields from tblCustomerDetails such as, address, date of
birth or whatever else you have.


This will autopopulate your subform AfterUpdate of [cboSearch]


Hope this helps

--
Wayne
Manchester, England.



 
L

Larry Linson

Hi Tammy

Sorry for the late reply -

Please post responses as followups in the original message thread, and
please avoid posting anyone's real e-mail address in newsgroups (where it
can and will be harvested by spammers). For other good suggestions on
effective use of newsgroups, see http://www.mvps.org/access/netiquette.htm.
Thanks

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top