Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

searching table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnE - 05 Jul 2007 19:52 GMT
There is a situation in which the client uses 2 fields in the table as the
primary key.  In a search field (Combo59) the 2 fields are concatenated
together and called FileNumber thru a query.  I get a type mismatch error in
the after update event of the combobox.  Below is the code that is used and
inorder to do a search, the 2 table fields will need to concatenated together
inorder for "FileNumber" to do the search.

   Me.RecordsetClone.FindFirst NewFindFirst("[FileNumber]",
Str(Me![Combo59]))
   Me.Bookmark = Me.RecordsetClone.Bookmark

I am at a loss as to how to go about doing a search using a concat cbo
against 2 fields in a table and seek assistance.  Also, don't be to harsh on
the naming conventions or process as this is coming from a new client that
had their "neighbor" develop this and I am now the lucky one to fix it.

Thank you inadvance for any assistance.

>>> John
Marshall Barton - 05 Jul 2007 21:17 GMT
>There is a situation in which the client uses 2 fields in the table as the
>primary key.  In a search field (Combo59) the 2 fields are concatenated
[quoted text clipped - 11 lines]
>the naming conventions or process as this is coming from a new client that
>had their "neighbor" develop this and I am now the lucky one to fix it.

It would help if you told us what the filenumber field looks
like, its parts and the same for the combo box's Value.

If you have code for the NewFindFirst function, that might
help too (though I suspect the use of a function may not be
necessary).

Signature

Marsh
MVP [MS Access]

John W. Vinson - 06 Jul 2007 03:19 GMT
>There is a situation in which the client uses 2 fields in the table as the
>primary key.  In a search field (Combo59) the 2 fields are concatenated
>together and called FileNumber thru a query.

That is neither necessary nor a good idea. FindFirst can use an argument which
is a legal WHERE clause to a query - it could have TEN fields in it. Creating
a redundant concatenated field will do you more harm than good!

Something like

Me.RecordsetClone.FindFirst "[Thisfield] = " & Me.cboFirstField _
  & " AND [Thatfield] = " & Me.cboSecondField

should work just fine.

            John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.