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.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Datagrid Shows Nothing [SOLVED BUT STILL UNCLEAR]
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:
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)
Set DG.DataSource = RecordSet
DG.Columns(0).Caption = "TEST"
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
Edited by - aleporrino on 7/5/2005 2:22:24 AM
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 & ""
The column in my Access database if set to the ShortDate format. Any ideas? Thanks.
VB 6.0 Application Shows Run-time Error '713': Only In Vista, Not In XP And 2000
Dear all ,
I have a VB 6 Application ( VB 6.0 with MS access) working well in all other Windows versions like Windows XP , 2000 etc .But it shows the ERROR " Run-time error '713': Application-defined or object defined error " while executing the program (.exe) from windows vista ( all versions ) what may be the problem with vista ?, i was tried with Administrator rights and compatipility mode set to windows XP SP2 but it shows same error . SAME PROGRAM WORKING WELL IN WINDOWS 2000 and XP. The setup was created with installshield 10 Express and added dependencies , but it shows same Error with windows vista.. What i have to do for vista enabling my application ? Please help me.. do i need to add any particular DLLs for vista ?
Problem With Time Difference (shows On The Minus Side)
I got help from someone on ICQ that made (or modified) me a code that could take one time, and another one, and then find the time difference between those two.
The code wasn't perfect thou... In my program, one of the times is a time stamp (let's say 22:38:40), and the other time is the current time being constantly updated by a timer (let's say it's 22:38:47). It works fine up to 22:38:59, but when the current time passes to the next minute (22:38:47) the time difference, which has worked fine so far, starts counting on the minus side.
If the time stamp shows 22:38:40 and the real time is 22:39:00 the time difference will now show 00:-1:-40. Then it will continue to count down. 22:39:05 will be 00:-1:-35 and so on. And when it counts down to 22:39:40, it finally goes back to the plus side again and the time difference shows 00:01:00. It counts correctly all in all, but it doesn't look correct some or most of the time.
Could somebody please help me with this? The code will be posted as a reply to this topic, so check it out if you want and send me a modified code.. Thanks
The Thing In WMP That Shows The Total Time Of A Sound File In Min/sec While It Plays
The thing in WMP that shows the total time of a sound file in min's/sec's while it plays ... we all see it when we select and play a sound or movie file, what is that function/event/routine/command/api called?
I have 12 command buttons that when each is pressed: (1) one .wav file plays (2) a picture is sent to a picture box (3) the name of the sound file is displayed.
I want to try and show that total time of the sound file while it is playing ... how? ideas?
Thank you for any insight,
Changing What The Editor/Debugger In Visual Basic Shows You At Any One Time.
The code I am writing has become quite large (3000+ lines with another few thousand on the way) and I need to find a way of "de-cluttering" the VB project on the screen.
I am currently using VBA in Excel (no budget for VB6) and wondered how I can strip out some of the functions from the view in the editor.
In C this was achieved by using the #include command. This was great as you did not have to actually see ABSOLUTLY EVERYTHING *sigh* in the editor which is proving to be quite cumbersom now. Any ideas on how to get around this?
Filtering Dates In Vs 05 Datagrid
I want to filter dates in a vs 05 data grid using two txtboxes.
So when the user types in the dates in the the textboxes it should return all of the results e.g.
txtbox1.txt = 12/10/05
txtbox2.txt = 18/10/05
It should return all of the dates between the start date and finish date in the datagrid
Populate Datagrid With Dates LIKE Text
Hi , I have code that I query an access database with input from a text box using the SQL LIKE term. The code works fine with text however when I insert the begiining of dates I get errors like invalid syntax or incomplete syntax or no results at all. This is an example of the line code concerned below.
Adodc1.RecordSource = "Select * From projandpro Where NAME LIKE '%" & Text1 & "%';"
Can anyone help on this. Thanks
Time And Dates
How do i check to see if a user has entered the time in the format that i want it. I know about IsDate but is there anything for Time.
Suppose i want the time is a medium time format then how do i do this. I also want to check if the user has used the " : " separator in the time entered.
My second problem is how do i calculate the total time . Should i just minus the end time from the start time or is there something more to it.
Thanks for all the help in advance,
Add Time Intervals Between Two Dates
I'm rally stuck with this. The database is time trucking and and payout of drivers. They can be on the road for ie 7 days. There are four differenttly paid time intervals. From 06:00-15:00, 15:00-18:00, 18:00-03:00 (next day) and 03:00 to 06:00. This is a cycle of 24 hours. The drivers are paid out for all the time they are on the tour.
Let say the dates are Startdatetime 20-10-2007 06:15 Enddatetime 22-10-2007 23:15
How to add the time for every interval within the dates?
I hope some can help me.
Time Interval Between 2 Dates
Hi guys. Is there an easy way in vb to find out number of seconds elapsed from one date to another? Im in a While loop and cant use a timer but need to timeout of the loop after about 4 seconds. Im saving the time before the while loop 'Now()' and want to check within the loop if the time has gone past 4 seconds. currentTime - StartTime method doesnt work. Any ideas? it has to include the date as i need it to work if the loop starts at 1 second to midnight and finishes at 3 seconds past too!
Adding Perioids Of Time To Dates
does anyone out there know how to add a period of time to a date.. e.g if i have a text box with a date in it and it is formated so it lays out as: 01/01/01, and i wish to add month(s) or year(s) to it (dependedent on users choice of period)how would i go about doing this so that if 13 months is added, it will increse the year by one, aswell as the month by one?
sorry for jibbering on, i hiope u can understand what im trying to ask
Calculate Time Difference Between Two Dates
I need a script which can do this:
- Calculate the difference in minutes between two date/time.
I now... you are going to say that i need to use de datediff function, but here is the trick.
I need to calculate the time based on working hours using working days and time.
For example, suppose that you work monday to friday from 9:00am to 6:00pm and you have a task and you need to know how much time have you spent on it.
The task arrived at your email at 7:00pm on Sunday... so you will start to work on it at 9:00 am on Monday.
If you finish the job on Wednesday at 10:00 you had spent 19 hours on the project... datediff will say 63 hours.
PS: Sorry for any grammar or syntax error, englush it's not my native language.
How Can I Retrieve Dates And Time Of Login?
Using VB I would to retrieve the time and date the RAS user login and logoff. Do you have any idea on how i will do this or any source code that may help. thanks.
The more u read, the more u do not know
Bind Datagrid At Run Time
OK, simple question
Can you bind a datagrid at run time if it is unbound at design time. Also, VB help on rebinding talks about a Datamode property, but I can't find anything else about it. Is this a typo or an outdated concept?
Set DataFormat Of Datagrid At Run Time
I need to set the dataformat of a datagrid at run time.
I want column 3 to be a checkbox
I want column 4 to be a boolean field with the true value as "OK" and the false value as ""
So I need to do something like this, perhaps?
frmRawData2.grdDataGrid.Columns("3").DataFormat = ???vbcheckbox
frmRawData2.grdDataGrid.Columns("4).DataFormat = ???vbboolean(truevalue= "OK", Falsevalue="")
but I'm not sure I've fully understood the DataFormat property very well!
I had a look around the forum but couldn't find anything. Is there a list of available constants for the dataformat property anywhere?
PS I apologise if this post is duplicated - I had trouble posting it.
Run Time Error '9' In Datagrid
I have a 'DataGrid' and TextBox name 'txtsubcode' .
Datagrid shows the details when i enter the code in TextBox.otherwise datagrid is empty.
If the DataGrid is empty and I click on DataGrid it shows an run time error '9'
how can i handel this error.
Binding Datagrid At Run Time
I've got troubles with binding a datagrid at runtime
some of my code in attachment.
I'm trying to bind my datagrid on a form dynamically. it represents all the orderlines of one order.
Can someone help me ?
Tnx in advance
Displaying A Time In A Datagrid
Hey guys, long story short...
When I click on my button ("Get Hours") it runs an SQL query that gets the userID, ClockInDate, and ClockInTime from a database (it is stored there in another section of code that is irrelevant).
A datagrid is populated with the contents of the database, and everything shows up fine except for the ClockInTime. Each entry shows up in the datagrid as 12/30/1899 - it's not even a time...it's a date.
If anyone can point me in the direction to fixing this, I would greatly appreciate it.
Formatting Time In A Datagrid Using CF 2.0
I am creating a PDA application using the CF 2.0 that will use a datagrid and will display time in one of the columns. The column is called "ScheduledTime" and in the sql server 2005 database the datatype is datetime.
I would like to format the time to display e.g. 21:45 24hr format.
I think the datagrid is very limited when using the CF for mobile applications as the property "format" doesn't exist for this. See my code below.
I am wondering is there another way to format time in a datagrid column using the CF 2.0.
Code:Me.grdSupportContracts.DataSource = ds.Tables(0)
Dim dgtbc As DataGridTextBoxColumn
dgtbc = CType(Me.grdSupportContracts.TableStyles(0).GridColumnStyles(3), DataGridTextBoxColumn)
dgtbc.Format 'Doesn't have the format property
Many thanks in advance,
On Datagrid Can We Put Check Box At Run Time
I want to know at
run time on datagrid can we put check box and on check can we change back color of that particular Row.
example I want to select row no 3 in data grid I will click on Checkbox which will appear on click event or button click event.and once i checked that box back color of
row no 3 will change to any other color.
please help me out
Change Dates Formated As Text To Dates In Excel From Vb6
I have a spreadsheet with mixed dates and dates expressed in text. From VB6 I want to programtically convert all text dates to dates. I know it shoudl be simple ... Im just not getting it ...
any help appreciated!
Added [RESOLVED] to thread title and green "resolved" checkmark - Hack
How Can I Calculate The No Of Days Between 2 Dates, Including The Selected Dates ?
How can I calculate the no of days between 2 dates, including the selected dates ?
for eg : between 1st Jan & 31 Jan there is 31 days
but when I calculate like this
DTPicker1.Value = 01/01/2003
DTPicker2.Value = 31/01/2003
totaldays = DTPicker2.Value - DTPicker1.Value
The result I get is 30, but in fact it should be 31
Peters A P
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.
Adding Rows To Datagrid One At At A Time
I am writing a program for a restaurant point-of-sale terminal and I am using a datagrid to display the items added tot he order. When you click on a button for a particular item, it adds the item name with it's price to the datagrid (from an ADO linked to an Access database). My problem is that it will only put one item in the grid at a time; i.e. if something is already there and you click a button to add another item, it simply replaces the first one. My question is how can I make it add multiple lines so that I can get an entire customer order into the grid? Or should I just use another method to display such information (i.e. datalist, label, textbox, etc.)? Any help would be greatly appreciated.
Edited by - ksucat on 11/6/2003 5:37:52 AM
Set Column Width In Datagrid At Run Time
Using a datagrid control bound to a disconnected recordset, so many properties must be set at run time. I can't find any way to set the width of a single column, or set a single column to expand to contain the data. Any suggestions?
Datagrid Row Selection (highlighted) At Run Time
I am new to datagrid and I need to have the data grid to highlight the first row in the grid when the form is loaded.
I have, among others, the following properties set:
MarqueeStyle = dbgHighlightRow
RecordSelectors = TRUE
but the row doesn't become highlighted until the right arrow key is used.
I should mention that this happens when the 'Visible' property of the first column is set to false.
Any help will be appreciated.
How To Create A DataGrid On Running Time ?
Hi, everyone :
If I want create a Label on running time .
I can code like under :
Dim Label1 as Label
set Label1 = Controls.Add("VB.Label", "Label1")
but If I want create a "DataGrid" on running time ,
Can you tell me how to code ?
Thanks very much
Compare Dates An Find If Dates Are A Week Apart
i would like to compare 2 dates an do an action if they are a week apart. I tried quite a few things to no prevail.
dim date 1 as date
dim date 2 as date
if date1 ARE A WEEK APART date2 then
do some thing
do other thing
early reply would be appreciated.
Coercing Blank Dates To Look Like Dates In Excel
I have an Access table with some date/time columns. Some of these columns have blank dates. When I export this table to Excel, since the first 10 or so records for this column has blank dates, Access/Excel thinks it's a text field and so when some dates actually appear, they are prefixed with a single quote and behave like text. Then when we import this data back into another Access database, all hell breaks loose.
The original query had Code:Non-Accrual Date AsDate: IIf([Non-Accrual Date]="00/00/0000" Or [Non-Accrual Date] Is Null,Null,DateValue([Non-Accrual Date]))
I changed it to Code:Non-Accrual Date AsDate: IIf([Non-Accrual Date]="00/00/0000" Or [Non-Accrual Date] Is Null,"",DateValue([Non-Accrual Date]))
Neither way coerces the blank/null values. Any other ideas?
The way to fix this manually in Excel is to remove all formats, the "shake the cell" by doing F2, Enter.
I couldn't coerce the Excel cells, but when I re-imported the data into another database I used Code:Expr6: IIf([Non-Accrual Date AsDate] Is Null,Null,CDate([Non-Accrual Date AsDate]))
Edited by - Geof on 4/5/2006 7:07:08 AM
Run-time Error '6160' Working With Datagrid
I am trying to set up a routine which returns the text value of a datagrid row when clicked by a user.
Is this possible, if so how do I fix the error message which I keep getting when I click on the datagrid???
Error Message: Run-time error '6160'
Data access error
Public cnT As New ADODB.Connection
Public rst As ADODB.Recordset
Public mSQLT As String
Private Sub Command1_Click()
Dim config As New config
Set cnT = New ADODB.Connection
cnT.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Documents and SettingsAdministratorMy DocumentsTechnical DataDevelopmentVB6 CODEProduct Database.mdb;Persist Security Info=False"
mSQLT = "SELECT [TB - Ingredients List].Name, [TB - Ingredients List].Description, [TB - Ingredients List].Supplier_ID FROM [TB - Ingredients List];"
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Open mSQLT, cnT, adOpenStatic, adLockOptimistic, adCmdText
Do While Not .EOF
Set DataGrid1.DataSource = rst
DataGrid1.DefColWidth = "2000"
DataGrid1.Caption = "The Results"
Private Sub DataGrid1_Click()
Text1.text = DataGrid1.text
Any help or suggestions would be appreciated.
How To Keep Data In The Cell In Datagrid Right Justified All The Time
I need help.
I have a datagrid that has 1 editable column. At loading time, the data in the column is right justified. When I click on the cell on that column to edit, the data becomes left justified until I change it then click to other cell, then data stay right justified.
Is there any way that I can have it stay right justified all the time when I click on the cell?
HELP! How Can I Change The Value Of A Datagrid Cell Programmatically At Run Time?
I have a Datagrid which I populate with a SELECT SQL sentence. My Datagrid shows the table of the Orders of a company. From data concerning past orders from the Database I calculate the average values of the time needed to complete each order. Then I want to insert them in a new column I insert in the datagrid.
I insert the new column:
DataGrid1.Columns.Add(4).Caption = "Approximate Time of Completion"
but I cannnot edit the values of the column's cells. I tried :
DataGrid1.Columns.Item(4).CellValue(2) = nTotalManHours (nTotal ManHours is thge variable with the value I want to insert)
but that doesn't work. Can you help? Which property allows me to change the value of a specific cell at run time?
I'm on a very tight schedule!!! I need an answer ASAP.
Reading Data From An ADO Recordset Connected To A Datagrid At Run Time In VB6
Maybe someone can point out for me what is it that I am not doing right here
I have a recordset rsP connected to DataGrid1, which works fine. I do not want to display all the recordset fields in the datagrid, but want several of them to be displayed in TextBoxes below the datagrid. When the user browses through the datagrid rows, the textboxes should be updated accordingly.
The problem is that if I have say 22 rows, but only 5 are visible, the textboxes stop being updated after 5 rows!!!! Even If I am at row 12 say, the textbox have not been updated since row 6. Now I change the browsing direction, I get another 5 updates and the textbox freezes again.
Am I using the righ event to update the textboxes? Am I missing some refresh command?
The recordset is connected to DataGrid1 as follows:
Set .DataSource = rsP
.Columns(0).Caption = "AAA"
.Columns(1).Caption = "BBB"
.Columns(2).Caption = "CCC"
.Columns(3).Caption = "DDD"
.Columns(2).Caption = "EEE"
.Columns(3).Caption = "FFF"
.Columns(4).Caption = "GGG"
.Columns(0).DataField = rsP("Ordinal_I")
.Columns(1).DataField = rsP("Issue_ID")
.Columns(2).DataField = rsP("Type")
.Columns(3).DataField = rsP("Name")
.Columns(4).DataField = rsP("Circumstances")
The textbox gets updated as follows:
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
Text1.Text = rsP("Name")
Any suggestion shall be appreciatted!
Edited by - santiago on 8/6/2003 7:00:52 AM
Grid Shows B-A Instead Of A-B
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,
'ReDimming the array
'As names and etc., are added to the Little Black Book
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
I = 0
For I = 0 To RecCount - 1
If I <> RecCount Then
Grid1.AddItem (BlackBook_RecArray(I)), 1
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?
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?
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"))
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?
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
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.
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 _
For I = 1 To UBound(idArray)
ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutTitle).SlideIndex
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.