 |
|
 |
|
Next: Knowledge Base Article-129927
|
| Author |
Message |
External

Since: Jan 29, 2004 Posts: 4
|
(Msg. 1) Posted: Thu Jan 29, 2004 6:37 pm
Post subject: Seeking Without Indices Archived from groups: microsoft>public>vb>database>dao (more info?)
|
|
|
Hi
I am trying to Seek thorough a database using code similar to this:
Dim myDB As Database
Dim myRS As Recordset
Set myDB = OpenDatabase("file.mdb")
Set myRS = myDB.OpenRecordset("Customers")
myRS.Index = Combo1.Text
myRS.Seek "=", Text1.Text
etc.
As you can see, I'm looking in a field which is chosen from a ComboBox by
the user. The trouble is, when running the app, I get this message:
Run-time error '3800':
'City' is not an index in this table.
or something similar, depending on what is chosen. It seems that to Seek in
a field, it must be indexed.
One solution to this problem would be to make every field an index, but I'm
sure that's not the best way. What should I do instead?
Thanks
Chris >> Stay informed about: Seeking Without Indices |
|
| Back to top |
|
 |  |
External

Since: Dec 18, 2003 Posts: 11
|
(Msg. 2) Posted: Thu Jan 29, 2004 6:37 pm
Post subject: Re: Seeking Without Indices [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Set myRS = myDB.OpenRecordset("select * from Customers")
should work; it will create a dynaset type of recordset instead of table
type.
Alex.
"Chris Mahoney" <chris RemoveThis @nzweb.net> wrote in message
news:BC3ED928.13D3%chris@nzweb.net...
> Hi
>
> I am trying to Seek thorough a database using code similar to this:
>
> Dim myDB As Database
> Dim myRS As Recordset
> Set myDB = OpenDatabase("file.mdb")
> Set myRS = myDB.OpenRecordset("Customers")
> myRS.Index = Combo1.Text
> myRS.Seek "=", Text1.Text
> etc.
>
> As you can see, I'm looking in a field which is chosen from a ComboBox by
> the user. The trouble is, when running the app, I get this message:
>
> Run-time error '3800':
> 'City' is not an index in this table.
>
> or something similar, depending on what is chosen. It seems that to Seek
in
> a field, it must be indexed.
>
> One solution to this problem would be to make every field an index, but
I'm
> sure that's not the best way. What should I do instead?
>
> Thanks
> Chris
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Seeking Without Indices |
|
| Back to top |
|
 |  |
External

Since: Jan 29, 2004 Posts: 4
|
(Msg. 3) Posted: Fri Jan 30, 2004 12:57 am
Post subject: Re: Seeking Without Indices [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Thanks, I'll give that a go tomorrow and see what happens.
Chris
On 1/29/04 4:48 PM, in article et2cxrh5DHA.2776.DeleteThis@TK2MSFTNGP09.phx.gbl, "Alex
Ivanov" <consul.DeleteThis@collegeclub.com> wrote:
> Set myRS = myDB.OpenRecordset("select * from Customers")
> should work; it will create a dynaset type of recordset instead of table
> type.
>
> Alex.<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Seeking Without Indices |
|
| Back to top |
|
 |  |
External

Since: Jan 29, 2004 Posts: 4
|
(Msg. 4) Posted: Fri Jan 30, 2004 2:15 pm
Post subject: Re: Seeking Without Indices [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
OK, tried that. Now it gets to the myRS.Index = Combo1.Text and bombs out
with RTE 3251, "Operation is not supported for this type of object."
I'm sure I'll figure it out eventually, but if someone knows what to do and
can save me the trouble, I'd be grateful
Chris
On 1/29/04 9:57 PM, in article BC3F3258.1C16%chris@nzweb.net, "Chris
Mahoney" <chris DeleteThis @nzweb.net> wrote:
> Thanks, I'll give that a go tomorrow and see what happens.
>
> Chris
>
>
> On 1/29/04 4:48 PM, in article et2cxrh5DHA.2776 DeleteThis @TK2MSFTNGP09.phx.gbl, "Alex
> Ivanov" <consul DeleteThis @collegeclub.com> wrote:
>
>> Set myRS = myDB.OpenRecordset("select * from Customers")
>> should work; it will create a dynaset type of recordset instead of table
>> type.
>>
>> Alex.
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Seeking Without Indices |
|
| Back to top |
|
 |  |
External

Since: Jan 29, 2004 Posts: 4
|
(Msg. 5) Posted: Fri Jan 30, 2004 2:31 pm
Post subject: Re: Seeking Without Indices [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
I got it working, in a somewhat messy way - I basically wrote my own Seek
function that doesn't require the fields to be indexed.
Chris
On 1/30/04 11:15 AM, in article BC3FED46.1C70%chris@nzweb.net, "Chris
Mahoney" <chris.RemoveThis@nzweb.net> wrote:
> OK, tried that. Now it gets to the myRS.Index = Combo1.Text and bombs out
> with RTE 3251, "Operation is not supported for this type of object."
>
> I'm sure I'll figure it out eventually, but if someone knows what to do and
> can save me the trouble, I'd be grateful
>
> Chris
>
>
> On 1/29/04 9:57 PM, in article BC3F3258.1C16%chris@nzweb.net, "Chris
> Mahoney" <chris.RemoveThis@nzweb.net> wrote:
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Seeking Without Indices |
|
| Back to top |
|
 |  |
External

Since: Dec 18, 2003 Posts: 11
|
(Msg. 6) Posted: Fri Jan 30, 2004 2:31 pm
Post subject: Re: Seeking Without Indices [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Did you try this?
Set myRS = myDB.OpenRecordset("select * from Customers")
myRS.Find("FieldName=" & SeekValue) 'Quote around the SeekValue if it is of
string type
if myRS.Eof Then 'Not found
.....
else 'here we are
....
end if
"Chris Mahoney" <chris DeleteThis @nzweb.net> wrote in message
news:BC3FF105.1C73%chris@nzweb.net...
> I got it working, in a somewhat messy way - I basically wrote my own Seek
> function that doesn't require the fields to be indexed.
>
> Chris
>
>
> On 1/30/04 11:15 AM, in article BC3FED46.1C70%chris@nzweb.net, "Chris
> Mahoney" <chris DeleteThis @nzweb.net> wrote:
>
> > OK, tried that. Now it gets to the myRS.Index = Combo1.Text and bombs
out
> > with RTE 3251, "Operation is not supported for this type of object."
> >
> > I'm sure I'll figure it out eventually, but if someone knows what to do
and
> > can save me the trouble, I'd be grateful
> >
> > Chris
> >
> >
> > On 1/29/04 9:57 PM, in article BC3F3258.1C16%chris@nzweb.net, "Chris
> > Mahoney" <chris DeleteThis @nzweb.net> wrote:
> >
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Seeking Without Indices |
|
| Back to top |
|
 |  |
| Related Topics: | DAO 3.6 record locking - Hi, Is it possible to programmatically lock a single record in a VB application using DAO 3.6? I would like to lock users' records when they log on to the app. Later I can check if a user's record is locked to see if they are logged in or not. (I....
Fixes for VB4 or DAO 3.0 - I've got VB4 (32-bit) and it seems to use DAO 3.0. Is there a service pack for either of these that I can use? I'm having issues with DAO and > 2GB of RAM on the machine, and don't want to have to move to a newer version of VB if I can help it, just t...
Jet error - I've just started getting this error message on a seemingly random basis. 'The Microsoft Jet database engine does not recognize 'CID' as a valid field name or expression.' CID is a text field, and it is a valid column name. The line of code that..
DAO reference / Access 2007 - while using an Access 2007 .accdb file I can access the dao. object very easily. the following code in VBA works well : Function getrecordcount(strTableName As String) As Long Dim dbCurrent As DAO.Database Set db = CurrentDb Dim rstRecords A...
Data Source - Data Report Designer - Is there a way to change the Database Source at run time in the Microsoft Data Report Designer? If so. How? |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|