Solved

DB GRID CONTROL AND DATA ACCESS

Posted on 1998-07-29
4
147 Views
Last Modified: 2008-02-01
This is really annonying me.  I have an access DB that I am accessing through VB.  I have a DBcombo DBGrid and Data Control.

I have about 7 forms.  Main form calls the other forms where I am running a query.  On the first 3 forms this works fine:

Private Sub DBCombo1_Click(Area As Integer)

Let Me.Data1.RecordSource = "SELECT * FROM [STUDENT QUERY] WHERE [student id]= '" & _
Me!DBCombo1.Text & "'"
Me.Data1.Refresh


Even though It appears that I have the exact same code and properties for the controls, On all the other forms when I open the dbcombo or when the form loads, I get this message

Runtime Error 438
Object does not support this property or method
It occurs with the Data1.Refresh.

If I remove Data1.refresh I don't get errors, but of course the dbgrid is not bound to my dbcombo.

What am I doing wrong?
thanks
0
Comment
Question by:DAVIDH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 40 total points
ID: 1467097
try dbgrid1.rebind

0
 

Author Comment

by:DAVIDH
ID: 1467098
It does not give me an error message, but it does not update anything either.

Any other ideas?
0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1467099
I would try this:

dim rs as recordset

set rs = data1.database.openrecordset("select * from table1", dbOpenDynaset)
set data1.recordset = rs
dbgrid1.rebind


0
 

Author Comment

by:DAVIDH
ID: 1467100
I found the problem,  Each form has a Data1 on it, When I change the name to data6 and the dbgrid recordsource to data6 it works, go figure, it must have been looking at a datacontrol on another form.

David
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question