Datagrid Shows Nothing [SOLVED BUT STILL UNCLEAR]
Hi Guys,
I swear I swear Iswear I have searched previous answers for ages before posting, but I really can't get my head around this. I'm just trying to display an Access table into a datagrid control. This is the code, part of a .bas Module in the project:
Code: Dim DG As DataGrid Set DG = DataViewData.DataGrid1 Dim cn As New ADODB.Connection Dim RecordSet As New ADODB.RecordSet Dim strSQL As String
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Test.mdb" strSQL = "SELECT * FROM Labels" Call RecordSet.Open(strSQL, cn, adOpenKeyset, adLockOptimistic) RecordSet.MoveFirst Set DG.DataSource = RecordSet DG.Columns(0).Caption = "TEST" DG.Refresh MsgBox (RecordSet(3)) cn.Close
1) The MsgBox correctly shows the value of the fourth field in the first record --> the recordset is correctly loaded 2) The caption of the first column of the datagrid is correctly "TEST" --> the datagrid is working
WHY IS THE REST OF THE DATAGRID BLANK???? NO DATA, NO NOTHING??? It must be something so simple....
Thanks in advance
Aleporrino
Edited by - aleporrino on 7/5/2005 2:22:24 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Datagrid Shows Dates, But Not Time.
I have a simple table with date/time (MS Access) fields. When I load this table into the datagrid, only the date is shown. No time. Anyone know a resolution to this? Is this a normal issue with datagrids? The datagrid itself must remain very flexible, so I can not statically format columns.
TIA!
Structure Unclear
db structure unclear
Hello, now my database structure is very very unclear, any good idea can easy join and change it.
only line-by-line edit and save , can auto batch match and changed ?
my database is use "|" CSV format
NAME|COUNTRY|PHONE|||||
Code:
'OLD DB this is very unclear
|Anthony|USA||803-2242423||||
|SAM|CHINA|204-2022424|||||
|||PETER||JAPAN||523-2234523|
|||||DAVID||UK|2004221
|MARY|||||JAPAN|2234235|
||JOHN||UK|20332|||
'I hope this...
|Anthony|USA|803-2242423|||||
|SAM|CHINA|204-2022424|||||
|PETER|JAPAN|523-2234523|||||
|DAVID|UK|2004221|||||
|MARY|JAPAN|2234235|||||
|JOHN|UK|20332|||||
many thanks!
Unclear Answer......
ok, I posted in the form wanting to know how to save the button click so that next time the user loads the program, the button is how the left it...
They used the SaveSetting and GetSetting functions to explain it, but when I do this...
Private Sub mnuAny_Click()
mnuAny.Checked = Not mnuAny.Checked
SaveSetting "Test", "Test Program", "thecheckvalues...", Check1.Value = True
End Sub
Private Sub Form_Load()
mnuAny.Checked = True = GetSetting("Test Program", "Test Program", "thecheckvalues", 0)
End Sub
I get "cant be set on this control" and I am using it on a menu...because thats what they used when telling me what to do... when I try to use this on the Check1.value = 1 statement...it wont work..
So I want to do this, but how?
Unclear Concepts On Class Modules
Hello!
I am trying to do the primitive.
I have a set of class module(.cls) and I want to change it into a module. (.bas)
Question is,
After a cut and paste job from a class module into a module.Can I still use the property get, let and set that is found in class module?
If yes, how do I call it? and how do I initialise it? .......I've realised I cannot use Set classmodule as new ClassModule...........
If not, how can I change the property get,set or let.....so that I can use them?
pardon my ignorance!!!!
Newbie programmer!
Target Line In MSChart Component & Unclear X-axis Labels?
1)How can I draw a horizontal line in MSchart? The line will represent a target to achieve. Example $15000.
2)The X-axis labels for columns are unclear and not easily read in my chart. How do I change this to be more clearly? I populated the chart with a data array and the chart itself manipulated the font, format, labels etc itself.
Thanks
(solved) Err... Datagrid Column
I wrote an small sub to autoresize the columns of my datagrid, but it has an little error... it doesn't work
What did i do wrong, when i run this vb will freeze and 30 seconds later it works again but nothing happend to my colums :/
VB Code:
Private Sub Command5_Click()On Error Resume NextDim StrSize As IntegerStrSize = 0 For i = 0 To dGrid.ApproxCount - 1 dGrid.Row = i For J = 0 To dGrid.Columns.Count - 1 dGrid.Col = J If TextWidth(dGrid.Text) > StrSize Then StrSize = TextWidth(dGrid.Text) dGrid.Columns(J).Width = StrSize End If Next Next End Sub
Adding To DataGrid (NOT SOLVED)
i have a datagrid (DG)
i have 3 columns (value1, value2, value3) as the captions for the DG
i would like to add the array element values to column 2 ("value2")
VB Code:
for counter = 0 to ubound(arrValues) dg.? = arrValues(counter)' this is where i am having problems of adding to the DGnext
PasswordChar In Datagrid SOLVED With Alternative
Hello,
I would like to know how you can fix a PasswordChar in a Datagrid by code?
example (I know this won't work)
Me.Datagrid.columns(7).text.PasswordCHar = "*"
Hope someone can help me...
tnx in advance !!
nickname
Datagrid Click Event <SOLVED>
is it possible that if i click a certain row in my datagrid, all the record on that row will be placed on its corresponding text box above it?
Size Column In Datagrid By Code (SOLVED)
Hello,
In my app. I use this code to size my columns:
Me.Datagrid.Columns(2).Width = 2500
Now, the forms that are finished are having no problems, and it works perfect BUT any form I create from now on, this code doens't work..
very strange I think!
What could be the problem ?
tnx in advance....
nickname
!! The code to size the columns may not be followed by a refresh... !!
Storing A DataGrid Record To A Textbox -SOLVED-
I want to allow the user to select a row from the datagrid and copy the individual fields of the selected record to individual textboxes for verification on the next screen.
Code:
Set conUDA = New ADODB.Connection
Set rsCust = New ADODB.Recordset
conUDA.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;Data Source=" & App.Path & "UDA.mdb; mode = read"
conUDA.Open
strSQL = "select * from CUSTOMERS where FNAME Like '" & strFname & "' and LNAME Like '" & strLname & "' and COMPANY Like '" & strCname & "' and PHONE Like '" & strPhone & "'"
With rsCust
.CursorLocation = adUseClient
.Open strSQL, conUDA, adOpenDynamic, adLockOptimistic, adCmdText
End With
If rsCust.RecordCount = 0 Then
MsgBox "No items found"
Else
Set DataGrid1.DataSource = rsCust
DataGrid1.Refresh
End If
After selecting the row and clicking next I want to transfer the selected fields to textboxes (as said above)...I am trying something like:
frmSession.txtFName.Text = DataGrid1.?????
Am I even close?
Edited by - melvijp on 12/7/2003 9:23:15 AM
ADODC Datagrid Update Problem... *SOLVED* Many Thanks To Pyash
Hi,
Apologies if this is too much of a newbie question but I've had a good hunt round and can't see the answer to this one so far.
My form contains a textbox, a adodc data and a datagrid.
The adodc is connected to my access db just fine. On form load, the connection is made and the datagrid shows all the records (names and addresses) in the table of my db. All good so far.
My objectives are to:
1. filter the records in the datagrid as the name is typed into text box. Sort of like a realtime query. Last names beginning with "p" datagrid refresh, "pe" datagrid refresh, and so on. (My database will not consisit of more than a few hundred records so I don't mind it eating resources if needs be).
2. pass the ID for the record onto a global integer.
What I have so far...
Private Sub txtLastName_Change()
'set the sql statement
sql = "SELECT * FROM People WHERE LastName = " & txtLastName.Text
'filter the returned data (this is the line that it is tripping up on!!!)
ADORecordset.Open sql, ADOconn, adOpenForwardOnly, adLockReadOnly
'refresh my datagrid
dgridPeople.Refresh
End Sub
Notes:
I believe the sql statement is ok (famous last words).
Any help greatfully appreciated and beers purchased if in Edinburgh!
Cheers, Cary
Edited by - underdone on 11/17/2004 6:15:33 PM
DataGrid Shows &"0,-1&", Instead Of &"Yes, NO&"
That is the way I have the field set up now. I've tried all the other types for boolean and get the same results.
That is the way that Access stores boolean values.
I still believe that the answer lies in the .DataFormat property, but I can't find any info in MSDN on the correct constant to give it.
Grid Shows B-A Instead Of A-B
Hi, All!
My grid is showing the last item in the array first instead of the first item. Tried looking for a Sort property for the grid (MSHFlexGrid), but there isn't one. Don't know where else to look.
Below is the code.
Any help would be appreciated!
Thanks in advance,
vbprogwb (Bob)
'ReDimming the array
'As names and etc., are added to the Little Black Book
ReDim BlackBook_RecArray(totalRecs)
RecCount = totalRecs
Grid1.Col = 1
Grid1.Row = 1
'This fills up the array with Type - udtItemRec/itemStruc
For X = 1 To RecCount
Get #1, X, udtItemRec
BlackBook_RecArray(I) = udtItemRec.strLName & Chr(9) & udtItemRec.strFName & Chr(9) & udtItemRec.strPhone & Chr(9) & udtItemRec.strEmail
I = I + 1
Debug.Print BlackBook_RecArray(I) 'x = x + 1
Next X
I = 0
For I = 0 To RecCount - 1
If I <> RecCount Then
Debug.Print BlackBook_RecArray(I)
Grid1.AddItem (BlackBook_RecArray(I)), 1
End If
Next I
BitBlt (nothing Shows Up)
Hi, I want my pic1 picturebox to show up somewhere on top of the screen (which displays over EVERYTHING). My project file is attached. I have been trying to figure this one out for some time now.
Thanks in advance.
Vb Shows 2 Forms Instead One
i made something like de MDI sample from the VB help.when i reference the first element of the array(an array of forms),Vb loads 2 forms.And the UBound() of the array shows that is only one element in the array.
That'is when i reference array(0),Vb shows 2 forms and UBound(array)=0.any idea?
thanks
Err.Number Shows 0
I have the following code that, on an error, writes to a DB.
The problem is, when I get the first error in the select case,
run-time error 76 - Path not found
my error reporting doesn't show Err.Number as 76 but 0
Also Err.Description is empty as well.
Am I missing something obvious here?
vb Code:
Private Sub mnuHelpBackup_Click()On Error GoTo ErrTrap Dim BackupDestination As String 'get backup destination from registry (Options form)BackupDestination = GetRegistryStr(hkeyCurrent_User, strSubKey, "BackUpPath") 'copyfile actual fileFileCopy App.Path & "CLDB.mdb", BackupDestination & "CLDB.mdb" Exit Sub ErrTrap: Select Case Err.Number Case Is = 76 'path not found - possible folder deleted or moved MsgBox "The selected path does not exist. It may have been " & vbCrLf & _ "moved or deleted. Please select a new path.", vbOKOnly + vbInformation, _ "Path does not exist" Case Is = 4004 'Backup failed MsgBox Err.Description & vbCrLf & "Error number " & Err.Number, _ vbOKOnly + vbInformation, "Backup Error" Case Else MsgBox "Database cannot be copied." & vbCrLf & "Error Number = " & Err.Number & vbCrLf & _ "Error Description = " & Err.Description, vbOKOnly + vbInformation, "Backup Error"End Select ProcedureName = "frmCodeLib mnuHelpBackup"Call ErrorControl(strUser, Err.Number, Err.Description, ProcedureName, _ Format(Now, "dd/mm/yyyy"), Format(Now, "hh:mm:ss"))
EDIT
When run in the VB IDE this works, but when I compile the program, I get the problem explained above.
Listbox Shows Twice The Same Value
Hi, I was just wondering how do you do this:?
Add something to the listbox but if the value I added is already in there, then it does not come up again. For example, If I add the Name "George" to the listbox and try to add it again, the name "George" should not come up again since its already in there.
How can I do this with the IF....THEN statement?
Thank You,
EnYcE
Color Cursor Shows Up B/w
I loaded various color cursors into form/picture box properties but they only show up black on white. Any ideas why?
Unwanted Form Shows
I started programming with a normal form as the startupform. I have several forms now and replaced the initial startupform with an MDI as the startup object (and made all my other forms 'CHILD')...
Unfortunately when I run the program some of my forms are loaded when I'm not wanting them to. I had to add some useless 'Unload frmxx' code to my project to prevent this...
Before, when I didn't have an MDI, it never happened.
I'm almost sure I'm not loading these forms in my code...
How comes they appear anyway
tia
You Slove One Problem And The Next Shows Up
ok i need to clear the form so that the bullets wont make a line but by clearing the form the "plane" blinks and it is very annoying. make it stop blinking or tell me how. sry if the dl doesnt work right this is my first time using it
PPT: Access Custom Shows
I've been looking for help with this for days and I'm just stuck. I want to select powerpoint slides defined in a custom show and copy them to a new presentation. The only thing google turned up was a 3rd party extension...and that won't work. Frustrating.
ActivePresentation.SlideShowSettings _
.NamedSlideShows("Quick Show").Delete
You'd think, I just change "delete" to "copy"...but no...that doesn't work either.
I got this far, but it shows the slide IDs in a message box; I need them to add themselves to a range Array and I can't figure out how to get them there instead of in a mesage box:
idArray = ActivePresentation.SlideShowSettings _
.NamedSlideShows("show a").SlideIDs
For I = 1 To UBound(idArray)
MsgBox idArray(I)
Next
ActivePresentation.Slides.Range(Array(I)).Copy
Presentations.Add WithWindow:=msoTrue
ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutTitle).SlideIndex
ActiveWindow.View.Paste
I'm lost. Any help greatly appreciated.
Form Shows Up Late
I'm making a Form that shows a file copying progress. The copy procedure starts on FormLoad. What I'd like to do is to show the whole form and the label.captions... before it starts copying. 'Cause now it just copies the files and shows the form after that.
Flexgrid Shows No Rows
I've been away from VB stuff for a number of months.
Today I opened up my projects and none of the mshflexgrids shows any rows.
I've got them bound to ado controls. I've tried doing an adoctrl.recordset.recordcount to make sure that there should be rows to show, and I get the correct amount of rows, but the rows never show in flexgrid.
The same is true with all the flexgrids in all my projects.
Control That Shows Webcam
Where can I get a control that shows me my webcam's picture, and let me capture it and stuff? I'm sure that there's already one on my computer, but maybe not.
Thx!
Flexgrid Shows Only One Line
I have a problem where a flexgrid will only display one line of data on one machine in the network - it works perfectly on the other machines in the network.
The data is being loaded from a text array.
Thanks for any hints on what may be causing this strange behaviour.
Nothing Shows After Maximizing The Window
Hi:
I’m relatively new to vb. I’m using vb 6 and am having problems with a window not showing correctly. The application uploads a file via ftp to a server. If the window is minimized while the file is being uploaded and then is maximized again, nothing shows in the window until the file is through uploading. I’m not quite sure where to start to correct this. Any help would be appreciated.
Thanks in advance for the help.
Chris
Which Type Shows Decimal.
Hi, im doing a sub routine that calculates a number that is shown as a currency in an excel sheet.
When i had the variables set to Long's it was fine but seemed to round to the nearest number. I tried variant and that worked but then an adding formula i had wouldnt work because it took the values as strings. So im stuck kinda. Either i find a type that works or find out how to switch the variant into a long in the subroutine. Thanks.
Date Shows Up As Time
When updating a record in my table with a new date, the date shows up as a time when I query the record. Looking at the field inside the actual database it looks like there's a date with the year 1895 (not sure how that got there) and a time. Here's my code:
dteDate = Date
strSQL = "UPDATE Topics SET DocumentName = """ & strFileName & """, ChapterTitle = """ & strChapterTitle & """, TopicTitle = """ & strTopicText & """, Notes = """ & strNotes & """, DateModified = " & dteDate & ", IsAddenda = " & blnIsAddenda & ", ProjectName = """ & strProjectName & """ WHERE ID=" & intRecordID & ""
myDB.Execute (strSQL)
The column in my Access database if set to the ShortDate format. Any ideas? Thanks.
If Nothing Shows Up Have A Listbox Say Sometihng?
Hey guys i have a listbox called list11, and it has the results of a scan from a button. IS there a code to get it that if nothing shows up in the list11 listbox, that an item would show up saying "Nothing found"
??
thank you.
Form That Shows Loading Bar
how would i go about making a preload form that displays a loading bar and then loads the main mdi form after its finished...? here is an example
Text Box Shows Number
hope you understand this i need some coding.......
If i type a number from 0-82 in text1 i want text2 to show the number 1
if i type a number between 83-174 i want text2 to show the number 2
if i type a number between 175-276 i want text2 to show number 3
this seems like really simple coding but i am a noob to vb i am just messing with it thats how i learn
Frame Shows Form
How can I make a frame(the one vb6 provides) show a form?
I tried this but it didn't work:
Private Sub Frame1_Load()
Frame1 = Form.show
End Sub
Anyone knows how?
VbTab In String Shows A Bar??
I have a string as follows
str = "ABC" & vbTab & "DEF"
when I put str into a flexgrid cell the tab converts into a thick vertical bar.
What do I need to do for it to actually put in a tab?
Thanks as always!
Steve
ps. I am still bang my head against the wall regarding how to define a Band in an Hierarchal Flex Grid (so I can make different columns different background colors)
Textbox That ONLY Shows Numbers ??
How do i make a textbox that you ONLY can write numbers in ?
I thought of something like this:
VB Code:
If txtNumbers.Text = "a" or "A" ThentxtNumbers.Text = ""End If
It works fine, but it will just be a hell of a lot of work !
And i'm... pretty lazy
Regards
A Quickie: Which Example Shows Better Form?
I have a quiz program that runs quizzes built off simple text file scripts.
One of the functions in the quiz editor is to jump the cursor to the first question. To do this I split the lines of the text box into an array called LineStr(). I start from the top and skip the optional file info tags, answer pools, and first chapter mark.
Tell me which way of tackling this a seasoned VB programmer would approve of more:
Code:
x = 0
Do
Temp = Left$(UCase(LineStr(x)), 5)
Select Case Temp
Case "TITL:", "AUTH:", "COMP:", "MODI:", "MVER:", "NOTE:", "TIME:"
x = x + 1
End Select
Loop Until Temp <> "TITL:" And Temp <> "AUTH:" And Temp <> "COMP:" And Temp <> "MODI:" _
And Temp <> "MVER:" And Temp <> "NOTE:" And Temp <> "TIME:"
or
Code:
x = 0
Do
Temp = Left$(UCase(LineStr(x)), 5)
Select Case Temp
Case "TITL:", "AUTH:", "COMP:", "MODI:", "MVER:", "NOTE:", "TIME:"
x = x + 1
Case Else
Exit Do
End Select
Loop
I know it seems totally trivial, but I just want to write code that won't have my fellow programmers scratching their heads or rolling their eyes.
Shows Up In Task Manager.
I'm writing a program in WindowsXP that I don't want to clutter up the users taskmanager window under Applications when its running. Now at first I figured I would have to register it as a service in the API but I found out that you can no longer do that in XP.
I was wondering if anyone else knew how to remove it from the Applications menu, and only make it show up if the click on the Processes menu next too it which shows all exes running.
Thanks for any help which you can render.
Which Control Shows The Desktop
Does anyone know which control, or how to manipulate the DriveList Control, to show the Folders, My Documents, My Computer, and Desktop, As they are shown in the SaveAs Dialog in most of the Office Products?
Thanks In Advance
My Installed .exe Shows A Message
Hey, friends, look what is happening to me:
After finished, I made a distribution package of my VB 6.0 program (.cab, setup.exe, and so on)
I tried to install it in several pc's, all of them with at least win95.
In some of them, when attemping to install, a message appear telling me something is needed about windows installation and the system must be restarted. When this, I did it.
In those cases, after restart the computer, I have to run setup.exe again, and the program is installed succesfully. (it seems to).
But when I try to execute the program at start-programs menu, a new message box appears telling me something like:
"You don't have the right license to use this functionality"
What's happening?
I do not understand why, cause it does not ocurrs in every computer, some of them work perfectly.
Somebody knows why?
Heyner.
Textbox Shows A Date
i am adding a summary to my application ..
how can a text box shows the last modified record date ( the date for the last record entered to the Database ????)
What API Shows A PictureBox In Greyscale?
Hello,
I'm developing an Activex control and need to do a PictureBox show a picture in
greyscale.
Is there a Windows API to do that?
Thanks for any help
michel_junior@hotmail.com
Data Shows On My Computer But Not On Others.
Hello all,
I've been working on a project that displays data from a Data Environment object which connects to a few different Access databases. Everything works fine on my computer, but when I try it out on another computer, none of the data loads for one (and only one) of the forms. Does anybody know any possible reason for this to happen?
The only difference between the data on this form and the others is that I was using data shaping, but I re-configured things to avoid data shaping and the problem is still there.
Kael
Grd Shows More Data Than It Should. URGENT
I have a datagrid connected to a table in an MS Access 2002 database by ADODC. This table contains a list of items.
When I run the program, the grid shows the complete list of items but at the end there are some of these items re-listed again (like ghosts of previous rows). These additional rows do not exist in the underlying database table when I open it alone with Microsoft Access.
I tried to delete the ADODC control and put a new one. I also tried to remove the grd and put a new one. No use.
If I simply delete these rows, then I check the database table, the original rows that are not repeated are missing.
What's going on?
Eman_2005
Technical Communicator
www.smartistek.com
Runtime Error 91. [Solved], ADO Global Connect [Not Solved]
I am sure this problem has to do with further lack of my knowledge of modules. But here is what is happening.
If you remember from my last post, I have a module now named Uconnect. Here is the code in thre:
VB Code:
Public Conn As ADODB.Connection Public Sub UserConnect()Set Conn = New ADODB.ConnectionConn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _& "SERVER=192.168.0.10;" _& "DATABASE=testim;" _& "UID=" & Form1.txtUser.Text & ";" _& "PWD=" & Form1.txtPass.Text & ";" _& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384 Conn.CursorLocation = adUseClientConn.OpenDebug.Print Conn.State End Sub
That all works great now when I call the Sub from my main form. Connection state shows a 1. Here is the problem. Right after I call this sub from the main form, I have an If Else statement checking to see if the connection is good.
VB Code:
Call UserConnectIf Conn.State = 1 Then Unload frmInfo Form1.Caption = "You are logged " Set rs = New ADODB.Recordset Etc, Etc, Etc.
On debugging, as soon as the Call to UserConnect is done I get this error on the If Conn.State =1 Then line.
RunTime Error 91
Object Variable or With block variable not set.
As usual, I am sure I am missing something simple.
Thanks again
Minimize To Systray Still Shows Title Bar
I followed the tutorial on min to systray and this now works fine. However, i have set showintaskbar to false and when i min to systray it still appears as a moveable title bar on my desktop (sorry i dont know what the correct title for this thing is - basically the head of my form). Any ideas how to remove this so when i min to systray i'm left with no trace of the program until I double click (on systray icon) to return it?
Thanks
|