why it not show data?

Posted on 2001-08-16
Medium Priority
Last Modified: 2011-09-20
i have 2 forms here. i want the DBGrid in form2 show data based onthe StudentNumber from Text1 in form1. i have success doing this. THANKS to all who have helped me before!

but, my problem is the DBGrid only show the first time entering StudentNumber only.

for example:
i enter StudentNumber for the first time : AH970001
the DBGrid show all the AH970001 data.

but when i enter StudentNumber for the second time: AH 970031
the DBGrid still show the AH970001 data.

i put this coding in my Form1

Form2.Show vbModal

is there any wrong here?

could anybody teach me on how to settle this problem?

i appreciate any help!
thanks in advance.
Private Sub Form_Load()
   Dim MySQL As String
   Dim Log As String
   Dim db As Database
   Text1.Text = Form1.Text1.Text
    Set db = DBEngine(0).OpenDatabase("c:\WINDOWS\Desktop\Psm2\PSM2.mdb")

   MySQL = "SELECT * FROM QStudentSubject where StudentNumber='" & Text1.Text & "'"
   Data1.RecordSource = MySQL
   Log = "StudentNumber='" & Text1.Text & "'"
   If Not Data1.Recordset.NoMatch Then
       Text1.Text = Data1.Recordset![StudentNumber]
       Text2.Text = Data1.Recordset![StudentIC]
       With Data1.Recordset
           If Not Data1.Recordset.EOF Then                
               DBGrid1 = Data1.RecordSource  
           End If
       End With
   End If

End Sub

Question by:arnab79
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

Expert Comment

ID: 6394340
Try rebinding when you refresh

Author Comment

ID: 6394447
i don't know how to rebind and the comment is so short.

Expert Comment

ID: 6394593

do that whenever you change the recordsource.  i might have them backwards (might be refresh before rebind)
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Expert Comment

ID: 6395013

you are relatively new to this site so I would ask you to please read the guidelines on comments vs answers at the bottom of this page and on http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp 

It is not considered good practice to lock questions in this way, as this places these questions in the locked section and reduces the visibility of the question to other experts. It also tends to put pressure on the questioner to accept the proposed answer. In future, please do not post "answers" except in trivial questions which have one and only one answer such as what is 1+1. I know that is a bit simplistic but I am sure you get the idea.

Having said that I hope that you continue to contribute to this site and that your experience proves useful to many others in future.
I am also rejecting your answer, for above reasons.


This does not mean that thi comment is not valuable, it still can be accepted as an answer.

Community Support Moderator @ Experts-Exchange
LVL 15

Accepted Solution

JackOfPH earned 45 total points
ID: 6395196
this is what dave mean...
With Data1.Recordset
          If Not Data1.Recordset.EOF Then                
              DBGrid1 = Data1.RecordSource
          End If
      End With
  End If

Author Comment

ID: 6395642
thanks to both dave and costello for trying to help me! :)
i appreciate it very much!
i'll try both of your suggestion now!
but, can i ask again if i still got problem?

Author Comment

ID: 6395650
oh, thanks to JackOfPH ! :)  :)

thanks for elaborating the suggestion for me!:)
i appreciate it very much!

Author Comment

ID: 6398044
hi everybody :)

i've tried Dave's and Jack's suggestion.
it worked!!!!
i'm happy! thank you!

Featured Post

Independent Software Vendors: 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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Suggested Courses
Course of the Month7 days, 22 hours left to enroll

765 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