Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

ADODC Query Problem

 
   Database Help (Home) -> Visual Basic -> ADO RSS
Next:  MS Windows Common Controls  
Author Message
Ed MacAlmon

External


Since: Nov 06, 2003
Posts: 4



(Msg. 1) Posted: Mon Feb 07, 2005 2:40 am
Post subject: ADODC Query Problem
Archived from groups: microsoft>public>vb>database>ado (more info?)

I have a VB6 form with several text boxes I would like to use to display
data stored in an Access db. I've used ADODC to bind the appropriate
form fields to the recordsource fields. If I use the ADODC in
adcmdTable mode, I get all the records and it works fine. However, I
want to use the adcmdText mode to query the table and select only the
records for a particular value. I cannot figure out why this sql select
statement does not get me any display. Here's the code:

SELECT * FROM Contract WHERE Corps_Institution = '" & Form3.Unit.Text & "'

Any idea what might be wrong here? I've tried oodles of changes but
cannot get any display. Any help appreciated. Thanks. --Ed

 >> Stay informed about: ADODC Query Problem 
Back to top
Login to vote
Paul Clement

External


Since: Sep 02, 2003
Posts: 236



(Msg. 2) Posted: Mon Feb 07, 2005 10:06 am
Post subject: Re: ADODC Query Problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, 07 Feb 2005 06:54:35 GMT, Ed MacAlmon <theemacs DeleteThis @swbell.net> wrote:

¤ I have a VB6 form with several text boxes I would like to use to display
¤ data stored in an Access db. I've used ADODC to bind the appropriate
¤ form fields to the recordsource fields. If I use the ADODC in
¤ adcmdTable mode, I get all the records and it works fine. However, I
¤ want to use the adcmdText mode to query the table and select only the
¤ records for a particular value. I cannot figure out why this sql select
¤ statement does not get me any display. Here's the code:
¤
¤ SELECT * FROM Contract WHERE Corps_Institution = '" & Form3.Unit.Text & "'
¤
¤ Any idea what might be wrong here? I've tried oodles of changes but
¤ cannot get any display. Any help appreciated. Thanks. --Ed

Did you call the Refresh method for the ADODC?


Paul ~~~ pclement DeleteThis @ameritech.net
Microsoft MVP (Visual Basic)

 >> Stay informed about: ADODC Query Problem 
Back to top
Login to vote
Ed MacAlmon

External


Since: Nov 06, 2003
Posts: 4



(Msg. 3) Posted: Mon Feb 07, 2005 12:40 pm
Post subject: Re: ADODC Query Problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ed MacAlmon wrote:
 > Paul Clement wrote:
 >
  >> On Mon, 07 Feb 2005 06:54:35 GMT, Ed MacAlmon <theemacs.RemoveThis@swbell.net>
  >> wrote:
  >>
  >> ¤ I have a VB6 form with several text boxes I would like to use to
  >> display ¤ data stored in an Access db. I've used ADODC to bind the
  >> appropriate ¤ form fields to the recordsource fields. If I use the
  >> ADODC in ¤ adcmdTable mode, I get all the records and it works fine.
  >> However, I ¤ want to use the adcmdText mode to query the table and
  >> select only the ¤ records for a particular value. I cannot figure out
  >> why this sql select ¤ statement does not get me any display. Here's
  >> the code:
  >> ¤ ¤ SELECT * FROM Contract WHERE Corps_Institution = '" &
  >> Form3.Unit.Text & "'
  >> ¤ ¤ Any idea what might be wrong here? I've tried oodles of changes
  >> but ¤ cannot get any display. Any help appreciated. Thanks. --Ed
  >>
  >> Did you call the Refresh method for the ADODC?
  >>
  >>
  >> Paul ~~~ pclement.RemoveThis@ameritech.net
  >> Microsoft MVP (Visual Basic)
 >
 >
 > Paul, I can't figure out how to do that. I am obviously a newbie. So
 > far I have been able to create an entry form w/ unbound controls, store
 > the data in an Access 2002 db, retrieve some particular record via an
 > sql SELECT statement and get it to populate the 18 text boxes on a
 > display form, but when I tried to use an ubound sql query to return a
 > group of recordsets, I couldn't figure out how to code step-through
 > buttons to step through the results, so I finally gave up on that and
 > created an ADODB control with the hope of using the sql query in the
 > adcmdText mode to limit the return and then use the control's
 > step-through functions to step through the records. That's where I am.
 > Though I hold a terminal degree in philosophy and am quite analytic,
 > and believe I have followed each of the 10 steps in the ADO Help file
 > "Using the ADO Data Control," subsection "Creating a Front-end Database
 > Application with Minimal Code," I can't get it to work. Following your
 > "refresh" question, I tried
 >
 > Private Sub AdoGroupUnitSearch_WillMove(ByVal adReason As
 > ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal
 > pRecordset As ADODB.Recordset)
 >
 > AdoGroupSearchResult.Refresh
 >
 > End Sub
 >
 > and got "Object variable or with block variable not set" as an error
 > message. I'm stuck here. What do you think? --Ed
 >
 >
Sorry about that, the Refresh statement was AdoGroupUnitSearch.Refresh<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ADODC Query Problem 
Back to top
Login to vote
Ed MacAlmon

External


Since: Nov 06, 2003
Posts: 4



(Msg. 4) Posted: Mon Feb 07, 2005 12:40 pm
Post subject: Re: ADODC Query Problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Paul Clement wrote:
 > On Mon, 07 Feb 2005 06:54:35 GMT, Ed MacAlmon <theemacs DeleteThis @swbell.net> wrote:
 >
 > ¤ I have a VB6 form with several text boxes I would like to use to display
 > ¤ data stored in an Access db. I've used ADODC to bind the appropriate
 > ¤ form fields to the recordsource fields. If I use the ADODC in
 > ¤ adcmdTable mode, I get all the records and it works fine. However, I
 > ¤ want to use the adcmdText mode to query the table and select only the
 > ¤ records for a particular value. I cannot figure out why this sql select
 > ¤ statement does not get me any display. Here's the code:
 > ¤
 > ¤ SELECT * FROM Contract WHERE Corps_Institution = '" & Form3.Unit.Text & "'
 > ¤
 > ¤ Any idea what might be wrong here? I've tried oodles of changes but
 > ¤ cannot get any display. Any help appreciated. Thanks. --Ed
 >
 > Did you call the Refresh method for the ADODC?
 >
 >
 > Paul ~~~ pclement DeleteThis @ameritech.net
 > Microsoft MVP (Visual Basic)

Paul, I can't figure out how to do that. I am obviously a newbie. So
far I have been able to create an entry form w/ unbound controls, store
the data in an Access 2002 db, retrieve some particular record via an
sql SELECT statement and get it to populate the 18 text boxes on a
display form, but when I tried to use an ubound sql query to return a
group of recordsets, I couldn't figure out how to code step-through
buttons to step through the results, so I finally gave up on that and
created an ADODB control with the hope of using the sql query in the
adcmdText mode to limit the return and then use the control's
step-through functions to step through the records. That's where I am.
Though I hold a terminal degree in philosophy and am quite analytic,
and believe I have followed each of the 10 steps in the ADO Help file
"Using the ADO Data Control," subsection "Creating a Front-end Database
Application with Minimal Code," I can't get it to work. Following your
"refresh" question, I tried

Private Sub AdoGroupUnitSearch_WillMove(ByVal adReason As
ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal
pRecordset As ADODB.Recordset)

AdoGroupSearchResult.Refresh

End Sub

and got "Object variable or with block variable not set" as an error
message. I'm stuck here. What do you think? --Ed<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ADODC Query Problem 
Back to top
Login to vote
Paul Clement

External


Since: Sep 02, 2003
Posts: 236



(Msg. 5) Posted: Mon Feb 07, 2005 3:15 pm
Post subject: Re: ADODC Query Problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, 07 Feb 2005 17:03:56 GMT, Ed MacAlmon <theemacs DeleteThis @swbell.net> wrote:


¤ >> Did you call the Refresh method for the ADODC?
¤ >>
¤ >
¤ > Paul, I can't figure out how to do that. I am obviously a newbie. So
¤ > far I have been able to create an entry form w/ unbound controls, store
¤ > the data in an Access 2002 db, retrieve some particular record via an
¤ > sql SELECT statement and get it to populate the 18 text boxes on a
¤ > display form, but when I tried to use an ubound sql query to return a
¤ > group of recordsets, I couldn't figure out how to code step-through
¤ > buttons to step through the results, so I finally gave up on that and
¤ > created an ADODB control with the hope of using the sql query in the
¤ > adcmdText mode to limit the return and then use the control's
¤ > step-through functions to step through the records. That's where I am.
¤ > Though I hold a terminal degree in philosophy and am quite analytic,
¤ > and believe I have followed each of the 10 steps in the ADO Help file
¤ > "Using the ADO Data Control," subsection "Creating a Front-end Database
¤ > Application with Minimal Code," I can't get it to work. Following your
¤ > "refresh" question, I tried
¤ >
¤ > Private Sub AdoGroupUnitSearch_WillMove(ByVal adReason As
¤ > ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal
¤ > pRecordset As ADODB.Recordset)
¤ >
¤ > AdoGroupSearchResult.Refresh
¤ >
¤ > End Sub
¤ >
¤ > and got "Object variable or with block variable not set" as an error
¤ > message. I'm stuck here. What do you think? --Ed
¤ >
¤ >
¤ Sorry about that, the Refresh statement was AdoGroupUnitSearch.Refresh

So is it working for you now?


Paul ~~~ pclement DeleteThis @ameritech.net
Microsoft MVP (Visual Basic)
 >> Stay informed about: ADODC Query Problem 
Back to top
Login to vote
Ed MacAlmon

External


Since: Nov 06, 2003
Posts: 4



(Msg. 6) Posted: Mon Feb 07, 2005 4:40 pm
Post subject: Re: ADODC Query Problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Paul Clement wrote:
 > On Mon, 07 Feb 2005 17:03:56 GMT, Ed MacAlmon <theemacs DeleteThis @swbell.net> wrote:
 >
 >
 > ¤ >> Did you call the Refresh method for the ADODC?
 > ¤ >>
 > ¤ >
 > ¤ > Paul, I can't figure out how to do that. I am obviously a newbie. So
 > ¤ > far I have been able to create an entry form w/ unbound controls, store
 > ¤ > the data in an Access 2002 db, retrieve some particular record via an
 > ¤ > sql SELECT statement and get it to populate the 18 text boxes on a
 > ¤ > display form, but when I tried to use an ubound sql query to return a
 > ¤ > group of recordsets, I couldn't figure out how to code step-through
 > ¤ > buttons to step through the results, so I finally gave up on that and
 > ¤ > created an ADODB control with the hope of using the sql query in the
 > ¤ > adcmdText mode to limit the return and then use the control's
 > ¤ > step-through functions to step through the records. That's where I am.
 > ¤ > Though I hold a terminal degree in philosophy and am quite analytic,
 > ¤ > and believe I have followed each of the 10 steps in the ADO Help file
 > ¤ > "Using the ADO Data Control," subsection "Creating a Front-end Database
 > ¤ > Application with Minimal Code," I can't get it to work. Following your
 > ¤ > "refresh" question, I tried
 > ¤ >
 > ¤ > Private Sub AdoGroupUnitSearch_WillMove(ByVal adReason As
 > ¤ > ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal
 > ¤ > pRecordset As ADODB.Recordset)
 > ¤ >
 > ¤ > AdoGroupSearchResult.Refresh
 > ¤ >
 > ¤ > End Sub
 > ¤ >
 > ¤ > and got "Object variable or with block variable not set" as an error
 > ¤ > message. I'm stuck here. What do you think? --Ed
 > ¤ >
 > ¤ >
 > ¤ Sorry about that, the Refresh statement was AdoGroupUnitSearch.Refresh
 >
 > So is it working for you now?
 >
 >
 > Paul ~~~ pclement DeleteThis @ameritech.net
 > Microsoft MVP (Visual Basic)

Paul I just went back to look at the code and re-entered the sql both in
the recordset property of the control and in the code section of
formload, along w/ a refresh statement--and it worked. Try # a billion
and one. But, I'm happy. Thanks for your help. On to the next issue. --Ed<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: ADODC Query Problem 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
ListBox with ADODC - I am using ADODatacontrol in my form, when I link TextBox with ADODC it shows me the records, but when I link this ADODC with ListBox it does not show any data. Please advice.

OpenSchema problem with MSDAORA and XP - A VB6 application I support accesses the database using ADO (2.5) . We use the OpenSchema call to check whether certain tables and/or columns exist. We get problems using the Microsoft Oracle OLEDB drivers (Provider=MSDAORA.1) under XP. Things work...

runtime error 3021 and user permissions - I have a VB6 application that uses ADO 2.7 to access an Access2000 database. I have found on Windows XP and 2000, that if the user is not part of the administrators group, they receive: "runtime error 3021. Either BOF or EOF is true, or the current ...

updatable ado-recordset - Hi, In the code below i have an updatable ado-recordset. However it is not working how i thought it would be. Maybe someone can help me out here? The global connection (Thanks to Brendan): Option Compare Database Option Explicit Public mconn As..

ADO Connection Access Database VB - I have been accessing a database on a local drive thru an ADO connection. The following is the code that I have been using. cnCejco.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Y:\Cejco.mdb;Persist Security Info=False" The problem is n...
   Database Help (Home) -> Visual Basic -> ADO All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
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



[ Contact us | Terms of Service/Privacy Policy ]