Invalid Picture - Error 481
Hi,
I'm trying to print a picture with two charts in it. But when I try to print the picture I get and error: invalid picture error 481 I can't seem to find an answer in the forum I have AutoRedraw set to true
Her's my code: Private Sub cmdPreview_Click() Dim obj As Object Set obj = Printer obj.Orientation = vbPRORLandscape
obj.PaintPicture Me.pctChart.Picture, pctChart.Left, pctChart.Top obj.EndDoc
End SubI'm I doing something wrong? Is there property settings to change?
Thanks in Advance
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Run Time Error 481- Invalid Picture
Hello All,
Our Netowrk admin denied access to the C: drive and since then the users get run time error 481- invalid picture while running a VB applications. Any ideas on how to resolve this. Our Network admin is adamant on not giving Access to the servers C: drive
Invalid Picture
is there a cleaner way to determine if a picture is valid or not other than using the Err object (meaning I want to prevent the Err from ever happening)
I guess I would want a ValidPicture() function that returns true or false or something like that.
Also - it can't just check for the file's existence because some pictures that are loaded are incomplete and give the invalid picture error 481 when i use the LoadPicture() function.
Invalid Picture
Hello reader,
I made a vb application and for the finishing touch I found a really nice icon. But when I want to use this item in the icon property I get the error message "Invalid picture". The icon has got the .ico extension, when I use a picture with a bmp or jpg extension I get the same message. I use vb6 and try to use xp icons, maybee this is the problem??
Thanx
Invalid Picture
I suppose to put a picture in my form but it give a Invalid Picture error.
Why is that?
Invalid Picture
Hi
I am developing one app which needs inbuild FTP support, so i am now developing an FTP Explorer. Everything is done except displaying file's default icons ( i.e. icons displayed in Windows Explorer). I am using the following code to extract the file's default icon
VB Code:
Option Explicit 'For looking at registry keys 'To: Open key ready to look at Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long 'To: Look at key Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As Any, lpcbData As Long) As Long 'To: Close the key when it's finished with Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long Private Const HKEY_CLASSES_ROOT = &H80000000 Private Const KEY_READ = &H20019 'To allow us to READ the registry keys 'For Drawing the icon 'To: Retrieve the icon from the .EXE, .DLL or .ICO Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long 'To: Draw the icon into our picture box Private Declare Function DrawIcon Lib "user32.dll" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long 'To: Clean up after our selves (destroy the icon that "ExtractIcon" created) Private Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long 'For Finding the System folder Private Declare Function GetSystemDirectory Lib "kernel32.dll" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Sub GetDefaultIcon(FileName As String, Picture_hDC As Long ) Dim TempFileName As String 'Never manipulate an input unless it doubles as an output Dim lngError As Long 'For receiving error numbers Dim lngRegKeyHandle As Long 'Stores the "handle" of the registry key that is currently open Dim strProgramName As String 'Stores the contents of the first registry key Dim strDefaultIcon As String 'Stores the contents of the second registry key Dim lngStringLength As Long 'Sets / Returns the length of the output string Dim lngIconNumber As Long 'Stores the icon number within a file Dim lngIcon As Long 'Stores the "Icon Handle" for the default icon Dim intN As Integer 'For any temporary numbers TempFileName = Right(FileName, Len(FileName) - InStrRev(FileName, ".") + 1) If LCase(TempFileName) = ".exe" Then strDefaultIcon = Space(260) lngStringLength = GetSystemDirectory(strDefaultIcon, 260) strDefaultIcon = Left(strDefaultIcon, lngStringLength) & "SHELL32.DLL" lngIconNumber = 2 GoTo Draw_Icon End If lngError = RegOpenKey(HKEY_CLASSES_ROOT, TempFileName, lngRegKeyHandle) If lngError Then GoTo No_Icon 'we do not even have a valid extension so lets NOT try to find an icon! lngStringLength = 260 strProgramName = Space$(260) 'Make space for the incoming string 'Get the key value: lngError = RegQueryValueEx(lngRegKeyHandle, vbNullString, 0, 0, strProgramName, lngStringLength) If lngError Then 'if there's an error then BIG TROUBLE so lets use the normal "windows" icon lngError = RegCloseKey(lngRegKeyHandle) 'the world may be about to end (or just an error) but we'll clean up anyway GoTo No_Icon End If lngError = RegCloseKey(lngRegKeyHandle) 'if this generates an error then we can't do anything about it anyway strProgramName = Left(strProgramName, lngStringLength - 1) 'Cut the name down to size 'Use the value of the last key in the name of the next one (strProgramName) lngError = RegOpenKey(HKEY_CLASSES_ROOT, strProgramName & "DefaultIcon", lngRegKeyHandle) If lngError Then GoTo No_Icon 'there is no icon for this extension so lets NOT try to load what doesn't exist! 'The rest is just the same as before lngStringLength = 260 strDefaultIcon = Space$(260) lngError = RegQueryValueEx(lngRegKeyHandle, vbNullString, 0, 0, strDefaultIcon, lngStringLength) If lngError Then lngError = RegCloseKey(lngRegKeyHandle) GoTo No_Icon End If lngError = RegCloseKey(lngRegKeyHandle) strDefaultIcon = Trim$(Left(strDefaultIcon, lngStringLength - 1)) intN = InStrRev(strDefaultIcon, ",") 'Find the commer If intN < 1 Then GoTo No_Icon 'We MUST have an icon number and it will be after the ",": NO COMMA NO DEFAULT ICON lngIconNumber = Trim$(Right(strDefaultIcon, Len(strDefaultIcon) - intN)) 'What number is after the comma strDefaultIcon = Trim$(Left(strDefaultIcon, intN - 1)) 'We only want what's before the comma in the file name Draw_Icon: lngIcon = ExtractIcon(App.hInstance, strDefaultIcon, lngIconNumber) 'Extract the Icon If lngIcon = 1 Or lngIcon = 0 Then GoTo No_Icon 'if 1 or 0 then after all that the Icon Could not be retrieved lngError = DrawIcon(Picture_hDC, 0, 0, lngIcon) 'Draw the icon in the box 'If that was unsucessful then we can't do anything about it now! lngError = DestroyIcon(lngIcon) 'Again we can't correct any errors now Exit Sub No_Icon: 'No icon could be found so we use the normal windows icon 'This icon is held in shell32.dll in the system directory, Icon 0 strDefaultIcon = Space(260) lngStringLength = GetSystemDirectory(strDefaultIcon, 260) strDefaultIcon = Left(strDefaultIcon, lngStringLength) & "SHELL32.DLL" lngIconNumber = 0 GoTo Draw_Icon End Sub
Here’s how to use this subroutine (remember that picture box's “AutoRedraw” property is set to True!:
This subroutine displays icon in the picture box but when i try to add this icon in the Imagelist control it gives the error 'Invalid Picture' ( I am using Treeview & Listview to display folders and files so i am trying add icons to imagelist)
Please help
Invalid Picture...?
I have a little vb program that uses the ImgEdit control. Every once in a while the program will load and display 'Invalid Picture' and bomb out. Any idea what causes this and how to fix it?
Thanks!
Invalid Picture
I get an error message "invalid picture" when I try to insert an icon on
a form or a picture in a picture box
--
Chilangisha B Changwe
email@removed
--
http://www.fastmail.fm - IMAP accessible web-mail
Invalid Picture
I'm using this code to create an image file from the data in SQL Server:
Dim RS As ADODB.Recordset
Dim mstream As ADODB.Stream
Set RS = New ADODB.Recordset
RS.Open "Select HighLogo from CompanyData WHere CompanyID = " & lngCompanyID, objConn, adOpenKeyset, adLockOptimistic
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.Write RS.Fields("HighLogo").Value
mstream.SaveToFile "c:publogo.bmp", adSaveCreateOverWrite
Picture1.Picture=LoadPicture("c:publogo.bmp")
I get an error "Invalid Picture"
File is created, but I cannot open it with Paint or Photoshop.
I link to the table in SQL Server from Access (I don't know any other way to see the picture in SQL Server field) and I can see the image there. So, SQL Server contains an image.
I tried to insert different format images into the table (BMP, JPG, GIF). All of them I can see via Access.
But when I retrieve the image and save as a disk file (tried with different extentions too), the file cannot be opened.
What's wrong?
Thank you
Icon = Invalid Picture?
Hey,
I have a 64x64 .ico file. It was saved specifically as a .ico file but VB tells me "Invalid picture". Why is that?
Thanks,
-Matt
Invalid Icon Picture??
I was making a form that I wanted to have an icon different then the default VB 6.0 icon. I have a valid .ico picture that a friend made and I tried to use it and it said it was an "invalid picture". Is there a proper way of setting an icon for a form that I don't know about?
Invalid Picture With ImageBox
I have a .jpg file that cannot be loaded with the ImageBox Control in VB (I get a "Invalid Picture" error). The file loads fine in MSPaint. If i open the .jpg file in MSPaint and save it again as Blah.jpg, the ImageBox will now let me load it in VB.
Is there a way to fix this without having to open it in MSPaint and saving it again as a .jpg file?
The only thing I think is happening is VB6.0 is old and this type of .jpg file is newer and it's not supported. Is there any way around this?
Invalid Picture In Icon
Hi to all:
I had try to insert a icon in a form made by articons format 48*48,and I got a message:"Invalid Picture".
Something wrong with the format of the icon,or something limitation by VB??
Thanks
Invalid Picture When Adding Icon
Hey,
I am trying to add an icon to my form and each time I try it I get a error saying "Invalid Picture". The Icon is a valid .ico file (Not just renamed to .ico or anything like that).
Please help!
Thanks,
Tom
Invalid Picture When Assigning An Icon
hi, i tried to assign an icon in my form... at first i was able to load some "flat icons" those with 2 colors or less and it worked but now i want assign better looking icons to my app and i get an error message that says: invalid picture... why? it's still the same .ico file! is it because of the size format of the color?
Picture Box Object Returns An Invalid Point Value
Hi!
I need a help about a picture box object. The object is parameterized as shown below (paste & copy from imediate window).
Although, returns the call below -1:
Picspec.Point(test, 10)
for test = -56,01186
The object returns for any coordinates the same value: -1.
Please, help!
Thanks in advance.
?Picspec.ScaleLeft
-100
?Picspec.ScaleTop
20
?Picspec.ScaleHeight
-20
?Picspec.ScaleWidth
200
?Picspec.Point(test, 10)
-1
?test
-56,01186
Invalid Picture When Image Not Selected In File List Box
When I click through the directory and file list boxes and find an image, it displays in an imagebox I have setup.
But if I click anything other than an image it comes up the error 'Invalid picture' how can I put in a message box saying 'not an image' instead of this VB error?
My code is: -
Code:
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub File1_Click()
Image1.Picture = LoadPicture(File1.Path & "" & File1.FileName)
End Sub
Invalid Qualifier Error ??? And Undefined Variable Error ???
Code:
Private Sub Form_Load()
If GetSetting(App.Title, "Startup", "counter", "") = "" Then
SaveSetting App.Title, "Startup", "counter", 1
SaveSetting App.Title, "Startup", "Started", Format(Date, "mm dd yyyy")
SaveSetting App.Title, "Startup", "Last Used", Format(Date, "mm dd yyyy")
lblcnt.Caption = "1"
for some reason when i compile my app, i get this error invalid qualifier at lblcnt <<
can anyone fix this? ...is it bcuz of this
Code:
Dim lblcnt As String
but b4 i put Dim lblcnt As String at the top...it was having an undefined variable error
Compile Error: Invalid Qualifier Error
Hi all
Just joined the forum looks very active (which is good).
After using MS Access for a few years, I thought it was time to learn VB and have started with VB6. After scrouging up a few books to use, I decided on the VB6 Bible from IDG books to start off with. So off I went working through the examples for creating a form etc. And came up with a problem....
the code...
Code:
Option Explicit
Private dbPrimary As Database
Private rsListData As Recordset
Private frmMDIRef As MDIForm
Public Sub Display(dbinput As Database, frmParent As MDIForm, sDataType As String)
Dim itemReturned As ListItem
Dim fldloop As Field
Dim i As Integer
Set dbPrimary = dbinput
Set frmMDIRef = frmParent
Me.Caption = sDataType
Set rsListData = dbPrimary.OpenRecordset("qryList" & fnRemoveSpaces(sDataType).dbOpenDynaset, dbSeeChanges)
ctlListView.View = lvwReport
ctlListView.Sorted = True
For i = 1 To rsListData.Fields.Count - 1
ctlListView.ColumnHeaders.Add "Column" & rstlistdata.Fields(i).Name
Next i
Do While Not rstlistdata.EOF
Set itemReturned = ctlListView.ListItems.Add( _
, _
"Item" & rsListData.Fields(0), _
rsListData.Fields(1))
For i = 2 To rsListData.Fields.Count - 1
itemReturned.SubItems(i - 1) = rsListData.Fields(i) & ""
Next i
Loop
End Sub
Private Function fnRemoveSpaces(sInput As String) As String
Dim sTmp As String
Dim i As Integer
For i = 1 To Len(sInput)
If Mid$(sInput, i, 1) <> "" Then
sTmp = sTmp & Mid$(sInput, i, 1)
End If
Next i
fnRemoveSpaces = sTmp
End Function
It errors with "Compile Error: Invalid qualifier" error on the section
fnRemoveSpaces(sDataType)
I've looked everywhere and can't find anything that might help me out hence the post.
Anyone have any ideas (remembering I'm a beginner)
TIA
Howard
UserControl ( Object Not Set - Error 91 And Invalid Use Error )
Hello all, ( two questions )
I have an user control that I am using that I got from the following URL. Http://209.207.250.132/dev/progress_control.htm When I use the UserControl an an OCX ActiveX control ( correct me if I am wrong on the definition ). The author was very nice and included the source file with the package, a CTL file. I am now trying to just add the UserControl to my project so that I don't have to worry about distribute any OCX file and registering it ( because I don't know how to test for it and install one from the VB program level ).
Ok, so I have a few problems. Since going the include with my project route, I have now lost properties Top, Left, Width, Height, Move and Visible. Since I never wrote a UserControl and only have written once class before I took what he had and put in what I think should be there, maybe you can tell me. The main control in the UserControl is a picture with a name 'picStatus' So I have inserted some properties so I can access them in my program since they didn't show up after I pressed the dot '.' after the variable name.
public property let Visible(byval bVisible as Boolean)
picStatus.Visible = bVisible
End property
public property get Visible() as Boolean
Visible = picStatus.Visible
End property
public property let Move(byval lLeft as Single, _
byval lTop as Single, _
byval lWidth as Single, _
byval lHeight as Single)
picStatus.Move lLeft, lTop, lWidth, lHeight
End property
public property get Height() as Long
Height = picStatus.Height
End property
public property let Height(byval New_Height as Long)
picStatus.Height = New_Height
End property
So will that work? The Move command does work when I use the following syntax in my code
pbArchiveLoadStatus.Move tRC.Left, tRC.Top, tRC.Width, tRC.Height
Something about 'Compile Error. Invalid use of property' Oh, I forgot, I define the variable ( or is it an Object or what? ) as following
option Explicit
Dim pbArchiveLoadStatus as vbwProgressBar
Question 2) Another problem I get with this implementation is I get the following error "Run-time error '91': Object variable or With block variable not set". I get this error if I insert any code one of these code snips..
SetParent pbArchiveLoadStatus.hwnd, StatusBar1.hwnd
pbArchiveLoadStatus.Top = tvArchiveListing.Top + tvArchiveListing.Height
pbArchiveLoadStatus.Left = iDEFAULT_BORDER_MARGIN_SIDES
pbArchiveLoadStatus.Width = tvArchiveListing.Width + iWIDTH_BETWEEN_CONTROLS
From MS site I find the following definition for this error ( http://support.microsoft.com/suppor...s/Q142/1/38.ASP )
You are attempting to use an object variable that is not yet referencing a valid object, or one that has been set to Nothing. Specify or respecify a reference for the object variable. For example, if the Set statement were omitted in the following code, an error would be generated:
Dim MyObject As Object ' Creates object variable.
Set MyObject = Sheets(1) ' Creates valid object reference.
MyCount = MyObject.Count ' Assigns Count value to MyCount.
I am not sure what I am doing wrong. I have tried all kinds of statements using Dim, Set, Private, Public or whatever. Is there a specific way I need to declare a UserControl? Any suggestions? I can send my project upon request. Thanks for the help
Mark
Invalid TLV Error !
Hi Mksolof:
It's me, Stephanie. I need your help again. I have the:
Invalid TLV error, could you tell me what the problem is?
Thanks,
Steph
Invalid Key Error !
Hi ,
My Problem ; Run-Time Error '35603: INVALID KEY !
Wrong line :
Code:Call ListView1.ListItems.Add(Sayac + 1, ServerTemp2(1), ServerTemp2(2), ServerTemp2(3))
Next Line :
Code:ListView1.ListItems.Item(Sayac + 1).Left = ListView1.ListItems.Item(Sayac + 1).Left - 1000
All Line :
Code:ServerTemp1 = Split(Kaynak, vbNewLine)
'Satir sayisi kadar server var
ServerSayisi = UBound(ServerTemp1)
For Sayac = 0 To ServerSayisi
'Satirlari / simgesine gore ayir
ServerTemp2 = Split(ServerTemp1(Sayac), "/")
'ListView e IP,ID ve Ikonu kaydet
Debug.Print "z"; ServerTemp2(1); ServerTemp2(2); ServerTemp2(3)
Call ListView1.ListItems.Add(Sayac + 1, ServerTemp2(1), ServerTemp2(2), ServerTemp2(3))
ListView1.ListItems.Item(Sayac + 1).Left = ListView1.ListItems.Item(Sayac + 1).Left - 1000
Next Sayac
Where is the problem ?
This project was without the mistake 2 months ago work
Edited by - BarisGurenc on 2/9/2007 6:24:21 PM
Error Invalid Ordinal (Error 452)
Hi Guys
I'm getting this error which comes and goes for some unknown reason. I think it errors somewhere in the following code. I'm using Access 97 (i know way out of date).
Code:
'msgbox NotWorkingCount
'msgbox WorkingCount
Dim PrIndex As Integer
'PrIndex = 1
'msgbox UBound(WorkingRefs())
For PrIndex = 1 To UBound(WorkingRefs())
For i = 0 To UBound(WorkingRefs()) - 1
'Set ref = References.AddFromFile(DLookup("[RefPath]", "[TableDBReferences]", "[RefID] = " & WorkingRefs(i)))
If WorkingPriority(i) = PrIndex Then
'msgbox "PR" & PrIndex & "(" & WorkingPriority(i) & ") (" & DLookup("[RefPath]", "[TableDBReferences]", "[RefID] = " & WorkingRefs(i)) & ") "
Set ref = References.AddFromFile(DLookup("[RefPath]", "[TableDBReferences]", "[RefID] = " & WorkingRefs(i)))
End If
Next i
Next PrIndex
Funny thing is when i put the msgbox's in it runs fine most of the time.
Can someone help on solving the problem. Or give me an understanding of what Invalid Ordinal.
Heres a quick explanation of what i'm trying to do.
I have in a table a list of references for use in the access database.
In that table i have the reference path and the priority as well as an ID column. So i want to execute the first priority ie priorty 1 first and go through it to the last priority.
Any eye opener would be greatful.
Thanks in advance
Invalid Call Error
I'm getting an invalid call error code
and can't figure out where since Debug dosen't fail
Here is the code
Dim TmpLine As String
Dim As Integer
Dim strAppPath As String
Dim strAppRoot As String
Dim strAppName As String
Dim strFunctionCode As String
Dim strAppFriendlyName As String
Dim iiDir
Public Sub Main()
TmpLine = Command()
TmpLine = strAppPath
= 1
= InStr( , TmpLine, ";")
strFunctionCode = UCase(Mid(TmpLine,1, -1))
strAppPath = Mid(TmpLine, + 1, Len(TmpLine))
= + 1
While ( <>0)
= InStr( , TmpLine, "")
If ( <> 0) Then
TmpLine = Mid (TmpLine, + 1, Len (TmpLine))
strAppName = TmpLine
End If
Wend
strAppFriendlyName = strAppName + "App"
'It fails somewhere above
Set iisDir = GetObject("IIS://LocalHost/W3SVC/1/ROOT/" + strAppName)
iisDir.GetInfo
If (strFunctionCode = "CREATE") Then
CreateWebApp 'Calling Function CreateWebApp
ElseIf (strFunctionCode = "DELETE") Then
DeleteWebApp 'Calling Function DeleteWebApp
EndIf
Exit Sub
ErrorHandler:
MsgBoc(Err.Description)
EndSub
Any ideas would help.
Thanks,
Eddy
Invalid Property Value Error
My application works fine on my computer upon which is intalled VB6. I installed the application on another computer and most of the app works fine but, i get error 380 invalid property value when trying to print stuff.
My probleme is that i cant reproduce this behavior on my computer. So i have no idea where in the code that the error occures.
I am assuming it has something to do with MDAC version or something similar...
Any idea on how to troubleshoot?
Error Keeps Sayign Invalid
I have created the code below, ia section of it checks to see if the pitch number entered is presnet in the pitch table, however even though it is it still comes up with a message box saying that it is not, any ideas?
Code:
Private Sub cmdSearch_Click()
Dim pitchId As String
Dim valid As Boolean
valid = False
pitchId = txtPitchEdit
tblPitch.MoveFirst
While Not tblPitch.EOF
If tblPitch!pitchNumber = pitchId Then
displayDetails
Else
MsgBox "Please enter a valid pitch number", vbOKOnly
End If
tblPitch.MoveNext
Wend
End Sub
' Displays the details of the particular pitch
Private Function displayDetails()
Dim pitch As String
Dim pType As String
Dim onPrice As String
Dim offPrice As String
Dim avaliable As String
pitch = txtPitchEdit
pType = txtPitchT
onPrice = txtOnPrice
offPrice = txtOff
avaliable = txtAva
tblPitch.MoveFirst
While Not tblPitch.EOF
' Displays pitch details in the text boxes
If tblPitch!pitchNumber = pitch Then
pType = tblPitch!pitchType
onPrice = tblPitch!onPrice
offPrice = tblPitch!offPrice
avaliable = tblPitch!avaliable
End If
tblPitch.MoveNext
Wend
End Function
Precision Is Invalid Error???
hello all,
i'm trying to use a command object from vb to insert a record into a sql database and return the unique identity.
every time i try to execute the command object, i get an error message 'The precision is invalid'
has enyone any idea what this actually means?
here's the VB code i'm using..
Set cnTag = New ADODB.Connection
Set rsTag = New ADODB.Recordset
Set cdTag = New ADODB.Command
cnTag.Open cnStr
Set cdTag.ActiveConnection = cnTag
cdTag.CommandText = "usp_insertGetNewTagNumber"
cdTag.CommandType = adCmdStoredProc
cdTag.Parameters.Append cdTag.CreateParameter("Tag_Number", adNumeric, adParamReturnValue, 6)
cdTag.Parameters.Append cdTag.CreateParameter("Type", adChar, adParamInput, 50, "TEST")
cdTag.Execute
here's the SQL stored proc..
Create proc usp_insertGetNewTagNumber
@Type nvarchar (50)
as
insert into TagNumber
(type) values (@type)
return @@identity
thanks,
a.
Error: Invalid Use Of Null Value
Dear all,
I'am trying to fill a form of student info from an access database but so fields in the db is empty and when i run the code the message appeare
Error : invalid use of null value
this is the table :
full users:
stuno: text
stuname: text
stuaccount: text
faculty: text
code:
stno = Form1.fg.TextMatrix(rsel, 0)
Set dbcon3 = New ADODB.Connection
Set rs3 = New ADODB.Recordset
str3 = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "full users.mdb"
dbcon3.Open str3
rs3.ActiveConnection = dbcon3
'----------------------
rs3.Open "select * from users where stuno like '" & stno & "'", dbcon3, adOpenKeyset, adLockPessimistic
'----------------------
If rs3.EOF = True Then
MsgBox "Student Not Found ", vbDefaultButton1, "Not Found"
Exit Sub
End If
Form3.Show
Form3.Label5.Caption = rs3!stuname
Form3.Label6.Caption = rs3!stuno
Form3.Label7.Caption = rs3!stuaccount
Form3.Label8.Caption = rs3!faculty
rs3.Close
dbcon3.Close
i want to check that if the field is null just veiw the other fields data
thanks
Invalid Use Of Null Error
I can't figure this out. Could someone tell me why I am getting this error with .TextMatrix(i, 9) = MyRecSet.Fields("TimeOff") highlighted?
Code:
Set oConn = New ADODB.Connection
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "TCdb.mdb"
Set MyRecSet = oConn.Execute("SELECT IDate, TimeIn, LunchOut, LunchIn, TimeOut, PTOHrs, OTHrs, RegHrs, TimeOff FROM TCTable")
MyRecSet.MoveFirst
With TClockGrid
Do While Not MyRecSet.EOF
For c = 1 To MyRecSet.Fields.Count - 1
For i = 2 To 8
If .TextMatrix(i, 1) = MyRecSet.Fields("IDate") Then
.TextMatrix(i, 2) = Format(MyRecSet.Fields("TimeIn"), "hh:mm am/pm")
.TextMatrix(i, 3) = Format(MyRecSet.Fields("LunchOut"), "hh:mm am/pm")
.TextMatrix(i, 4) = Format(MyRecSet.Fields("LunchIn"), "hh:mm am/pm")
.TextMatrix(i, 5) = Format(MyRecSet.Fields("TimeOut"), "hh:mm am/pm")
.TextMatrix(i, 6) = Format(MyRecSet.Fields("PTOHrs"), ".00")
.TextMatrix(i, 7) = Format(MyRecSet.Fields("OTHrs"), ".00")
.TextMatrix(i, 8) = Format(MyRecSet.Fields("RegHrs"), ".00")
.TextMatrix(i, 9) = MyRecSet.Fields("TimeOff")
End If
Next i
Next c
MyRecSet.MoveNext
Loop
End With
MyRecSet.Close
oConn.Close
Set MyRecSet = Nothing
Set oConn = Nothing
Invalid Object Error. Please Help
I have few tables which are created by the name of the logged in user from my VB application. I have created the application in that way so that when ever a particular user log in i dont have to prefix his user name to access his table. It was working fine few days back but not I am getting error when i am not prefixing the table name with the user name, as "Invalid Object".
I created a new user and assign him the same permission as this MANAGER and it worked fine for the new user but for MANAGER is still not accessing his table without prefixing his username. I can access his table only by prefixing his user name with the table like
When I issue query
Select * from tmp_comparison
[output]
Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'tmp_comparison'.
When I issue query
Select * from manager.tmp_comparison
[output]
all rows are shown..
I am using SQL server 7.0
Please help why its giving me error this time.
Invalid Authorizationspecification Error - Why?!
Hi,
I am using ADO 2.7 with VB 6.0 on win2000 machine
I had -2147217865 error "Invalid authorizationspecification" when try to make a conection at the line
Code:
conSource.Open
My code is:-
Code:
Dim conSource As ADODB.Connection
Dim rsSource As ADODB.Recordset
Dim strSourcePath As String
Dim strSourceSQLStat As String
Dim strdbProvidoer As String
strdbProvidoer = "Provider=" & "SQLOLEDB"
strSourcePath = "Data Source=" & "C:Program FilesMicrosoft SQL ServerMSSQLDatapubs.mdf"
strSourceSQLStat = "select * from pubs.dbo.authors"
Set conSource = New ADODB.Connection
conSource.CursorLocation = adUseClient
conSource.ConnectionString = strdbProvidoer & ";" & strSourcePath & ";Persist Security Info=False"
conSource.Open
Set rsSource = New ADODB.Recordset
rsSource.Open strSourceSQLStat, conSource, adOpenDynamic, adLockOptimistic
Invalid Bookmark Error
I'm using a variant variable to store a recordset's bookmark (before executing an sql update query) so i can return to that point later.
This was working fine a few hours ago but now i'm getting "Invalid bookmark" when i modify some columns in my access database.
Could this be due to database corruption?. I tryed Access's Compact and Repair utility but that didn't help.
Any help is greatly appreciated!.
Invalid Qualifier Error
Good day,
I have a string and would like to build a user defined array to populate the values in it, unfortunately I’m getting the error ‘invalid qualifier’. Can somebody please help. Thank you
Code:
Dim marrRegStatus() As String
Dim udtRegStatus() As TRegStatus
Private Type TRegStatus
StrCode As String
strRegStatus As String
End Type
ListData = “1, Accepted; 2, Rejected; 3, No decision”
searchChar = ","
marrRegStatus = Split(ListData, ";") 'split the data into array and later used for ‘populating the code and status
For i = 1 To UBound(marrRegStatus)
‘ ReDim Preserve udtRegStatus(i)
lngCommaPos = InStr(1, marrRegStatus(i), searchChar)
lngEndCommaPos = lngCommaPos - 1
udtRegStatus.StrCode(i) = Mid(marrRegStatus(i), 1, _ lngEndCommaPos) ‘I get error here udtRegStatus is highlighted
udtRegStatus.strRegStatus(i) = Mid(marrRegStatus(i), lngEndCommaPos + 1)
cboRegStatus.AddItem udtRegStatus.strRegStatus(i)
Next
Invalid Property Value Error?
hey guys I have an update program that does this..
VB Code:
'OnResponseStart when you can safely access the headers.'OnResponseDataAvailable which returns a byte array of downloaded data for each chunk.'OnResponseEnd which ends the download. Option Explicit'' Code for opening webpages ''Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ByVal hwnd As Long, _ByVal lpOperation As String, _ByVal lpFile As String, _ByVal lpParameters As String, _ByVal lpDirectory As String, Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long Private Declare Function ReplaceFileW Lib "Kernel32.dll" (ByVal lpReplacedFileName As Long, ByVal lpReplacementFileName As Long, ByVal lpBackupFileName As Long, ByVal dwReplaceFlags As Long, ByVal lpExclude As Long, ByVal lpReserved As Long) As Boolean Public Sub FillCombo(objComboBox As ListBox, _ oConn As ADODB.Connection, _ strSQL As String, _ strFieldToShow As String, _ Optional strFieldForItemData As String) Dim oRS As ADODB.Recordset 'Load the data Set oRS = New ADODB.Recordset oRS.Open strSQL, oConn, adOpenForwardOnly, adLockReadOnly, adCmdText With objComboBox 'Fill the combo box .Clear If strFieldForItemData = "" Then Do While Not oRS.EOF '(without ItemData) .AddItem oRS.Fields(strFieldToShow).Value oRS.MoveNext Loop Else Do While Not oRS.EOF '(with ItemData) .AddItem oRS.Fields(strFieldToShow).Value .ItemData(.NewIndex) = oRS.Fields(strFieldForItemData).Value oRS.MoveNext Loop End If End With oRS.Close 'Tidy up Set oRS = Nothing End Sub Public Function ReplaceFile(ByVal lpReplacedFileName As String, ByVal lpReplacementFileName As String, ByVal lpBackupFileName As String) As Boolean 'If lpBackupFileName parameter is NULL, 'no backup file is created. Const REPLACEFILE_WRITE_THROUGH& = &H1 ReplaceFile = ReplaceFileW(StrPtr(lpReplacedFileName), StrPtr(lpReplacementFileName), StrPtr(lpBackupFileName), REPLACEFILE_WRITE_THROUGH, ByVal 0&, ByVal 0&) End Function Private Sub httCheckVersion_OnResponseStart(ByVal Status As Long, ByVal ContentType As String) If Status <> 200 Then MsgBox "Remote file not found", vbExclamation + vbOKOnly httCheckVersion.Abort Set httCheckVersion = Nothing End If End Sub Private Sub httCheckVersion_OnResponseDataAvailable(Data() As Byte) Dim remotetext As String remotetext = httCheckVersion.ResponseText txtServer = remotetext Set httCheckVersion = Nothing Exit Sub End SubPrivate Sub CheckForUpdates()Dim RemoteTextFile As String RemoteTextFile = "http://www.geocities.com/nitrogenocide2003/ServerIP.txt" Set httCheckVersion = New WinHttpRequest Dim sDownloadURL As String httCheckVersion.SetTimeouts 25000, 25000, 250000, 250000 sDownloadURL = RemoteTextFile httCheckVersion.Open "GET", sDownloadURL, True 'True means asynch. httCheckVersion.send End Sub Private Sub ReplaceExeInUse() Dim FileToUpdate As String Dim FileBackUpName As String FileToUpdate = App.path & "DatabaseMain1.mdb" FileBackUpName = App.path & "DatabaseMain1.backup" Dim result As Long Call ReplaceFile(FileToUpdate, App.path & " mpDatabaseMain1.mdb.", FileBackUpName) result = ShellExecute(Me.hwnd, "open", FileToUpdate, "/updaterestart " & GetCurrentProcessId(), "", 1) End End Sub Private Sub Command1_Click()Text2.Text = "Connecting to Update Service."Text2.Text = Text2.Text & vbNewLine & "Beginning Updates..."Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Live Help Server IP address..." CheckForUpdates Open App.path & "ServerIP.txt" For Output As #1Close #1 Open App.path & "ServerIP.txt" For Append As #1 Write #1, txtServer.Text Close #1 Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Live Help Server IP address... DONE!" Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Antivirus / Antispyware Defininition Updates..." ' Create the WinHTTPRequest ActiveX Object.Set http = New WinHttpRequest' Open an HTTP connection.http.Open "GET", "http://microhardxce.110mb.com/DatabaseMain12.mdb", True 'True means asynch. ' Send the HTTP Request. http.sendText3.Text = "On" End Sub Private Sub Command2_Click()Unload UpdaterEnd Sub Private Sub Command3_Click()Set WinHttpRequest2 = New WinHttpRequest WinHttpRequest2.Open "GET", "http://www.geocities.com/nitrogenocide2003/ServerIP.txt", True WinHttpRequest2.send End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If Text3.Text = "ON" Then http.AbortEnd If'httCheckVersion.Abort'http.Abort'WinHttpRequest2.Abort 'Unload Command1List2.ClearText2.Text = ""Unload UpdaterEnd Sub Private Sub http_OnResponseDataAvailable(Data() As Byte)mProgress = mProgress + UBound(Data) + 1ProgressBar1.Value = mProgress Put #1, , Data End Sub Private Sub http_OnResponseFinished()Close #1'MsgBox "Updated database downloaded and installed! Please restart the program for updates to take affect."Text2.Text = Text2.Text & vbNewLine & "Downloading Latest Antivirus / Antispyware Defininition Updates... DONE!"Text2.Text = Text2.Text & vbNewLine & "Please restart the program for the updates to take affect." PlaySound App.path & "databasedlok.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC Antivirus.Text10.Text = Antivirus.Text10.Text & vbNewLine & "Updated database downloaded and installed! Please restart the program for updates to take affect."End Sub Private Sub http_OnResponseStart(ByVal Status As Long, ByVal ContentType As String)Text1.Text = http.GetAllResponseHeaders()mProgress = 0mContentLength = CLng(http.GetResponseHeader("Content-Length")) ProgressBar1.Max = mContentLengthOpen App.path & "DatabaseMain12.mdb" For Binary As #1 End Sub Private Sub Label3_Click()ShellExecute Me.hwnd, "open", "http://www.geocities.com/nitrogenocide2003/MHXBuy.html", vbNullString, vbNullString, ByVal 1&End Sub Private Sub WinHttpRequest2_OnResponseDataAvailable(Data() As Byte) mProgress = mProgress + UBound(Data) + 1 ProgressBar1.Value = mProgress Put #1, , Data 'This holds your file End Sub Private Sub WinHttpRequest2_OnResponseFinished() Close #1 MsgBox "Updated Server IP downloaded and installed! Please restart the program for updates to take affect."Text3.Text = "OFF" End Sub Private Sub Form_Load()Label9 = FileDateTime(App.path & "DatabaseMain12.mdb") Label10 = Format(FileLen(App.path & "DatabaseMain12.mdb") / 1024, "#,### KB")Dim con As ADODB.ConnectionDim strSQL As StringDim strCol As StringSet con = New ADODB.Connectioncon.CursorLocation = adUseClientcon.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.path & "DatabaseMain12.mdb;" & "Jet OLEDB:Database Password=omegacron2;"strSQL = "SELECT * FROM table1"strCol = "viruslist"Call FillCombo(List2, con, strSQL, strCol)con.CloseSet con = Nothing Label7.Caption = " " & List2.ListCount End Sub Private Sub mnuclose_Click() Unload UpdaterEnd Sub
Now the prog works, it downloads files and what not, but when I am in the middle of a download and I exit the updater I get the error "invalid proeprty value and it highlights the code....
ProgressBar1.Value = mProgress
in the code...
VB Code:
Private Sub http_OnResponseDataAvailable(Data() As Byte)mProgress = mProgress + UBound(Data) + 1ProgressBar1.Value = mProgress Put #1, , Data End Sub
Anyone know how I may fix this bizarre thing?
Error 30009 Invalid Row Value-plz Help
Hi can anybody help me in this?
I have this small piece of code to populate the 1st col of a flexgrid
J = 0
Dim rsTmp As New ADODB.Recordset
Set dbADI = New DAL.clsDb
dbADI.OpenConnection "ADI"
Set rsTmp = dbADI.RunQuery("tblEmpStn", , , , , False)
If rsTmp.BOF = False And rsTmp.EOF = False Then
rsTmp.MoveFirst
With MSFlexGrid1
Do Until rsTmp.EOF
MSFlexGrid1.Col = 0
MSFlexGrid1.Row = J ------>here it shows the above error...?
MSFlexGrid1.Text = rsTmp!FirstName
J = J + 1
rsTmp.MoveNext
Loop
End With
I have set the fixed row to 1 in flexgrid properties.
How can I overcome this?
End If
Error : The Precision Is Invalid
I am trying to execute a SQL Server 2000 stored procedure in a Visual Basic 6.0 program. I am getting the following error and don’t know how to fix it.
-2147467259 The precision is invalid
On the SQL Server the field name is GuestAcct. GuestAcct is a numeric size 9 with a precision of 18.
here is the code : please help me...
VB Code:
Command.CmdsCmd.ActiveConnection = conCmd.CommandType = adCmdStoredProc Cmd.CommandText = "sp_invoiceD_add" with msfgrid Cmd.Parameters.Append Cmd.CreateParameter("invoice_id", adVarChar, adParamInput, 50, Trim(Me.txtInvoiceID.Text))Cmd.Parameters.Append Cmd.CreateParameter("GuestAcct", adNumeric, adParamInput, 9, Trim(.TextMatrix(i, 4))) end with Cmd.Execute
thanks in advance... ^^
Error Invalid Outside Procedure
I have a code to change computer names but when run an error invalid outside procedure(line "please enter a new computer name"). Any sugestions is very much appreciated. thanks
VB Code:
Private Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As LongPrivate command2_click() Dim sNewName As String 'Ask for a new computer name sNewName = InputBox("Please enter a new computer name.") 'Set the new computer name SetComputerName sNewName MsgBox "Computername set to " + sNewNameEnd Sub
Error: Invalid Use Of Null
Hi,
I have developed a new form.
There are no records in the table.
first time when i try to add the record, i am getting the error "Invalid Use of Null".
citycode is auto incremented number.
i have taken max(citycode).
if there are no records, citycode shd be 1 else max+1.
pl help me.
regards
Error 380 Invalid Property Value
Hello
In my app the user clicks on a line in a list box and this manipulates the text in a RTB. The code for this is all in the mouse_up event.
The RTB is the only thing that get properties manipulated. The propertires that it works with are:
SelStart
SelColor
SelLength
And the Find method.
Now for the wierd part. For a couple of users (2 of 15) when they click on a line in the list box they get an error 380 invalid property value. But it's not all of the lines. In the one case with 48 lines in the list box it happens on lines 4 - 19. The only lines that do anything different are the first and the last so they should all show the error and not just a few.
I've been unable to reproduce the error on any of my machines. And these users are a fair distance from me so going there to troubleshoot on sight is not really in the cards.
So, I guess what I'm asking is: Does anyone have any Ideas for some error traping that will help me identify where the error is ocurring? I tried err.source but it just gives me the name of my project. If there were a way to get a line number that would be ideal.
Or does anyone have any ideas what is causing this?
Thanks
David
Invalid Use Of Property Error
I am using the following code to allow users to enter the first letter of a list of items in dropdown boxes and have the box populate:
VB Code:
Dim txtTmpValue txtTmpValue = cboDrugType_r.Text 'Auto populates the value of the combo box by the first letter entered. Select Case txtTmpValue Case "G" cboDrugType_r.Text = "Generic" Case "B" cboDrugType_r.Text = "Brand Formulary" Case "N" cboDrugType_r.Text "Brand Non-Formulary" Case "g" cboDrugType_r.Text = "Generic" Case "b" cboDrugType_r.Text = "Brand Formulary" Case "n" cboDrugType_r.Text "Brand Non-Formulary" End Select
I've used this same procedure many times, but this time it's giving me an Invalid Use of Property error and highlighting the "Case N" line. Does anyone know why?
Invalid Qualifier Error
Hi to all,
is there a way to use a string variable containing the name of the image object in my form and set its property programmatically?
ex: "image1" --> name of string that has been filtered out from the text file and assign it to a variable X.
code:
X.Picture ="C:arrow.ico"
From here , i got an error message "invalid qualifier"
Error Invalid Use Of Null
hello,
i'm working on vb6.0 with ms access as backend. i'm having a table say "table1" which has two fields(delcharge and cramt) of the datatype 'number' with format as 'fixed'(say 3459.25)and field size as "double".so whatever i insert into this table will be stored with two decimal places.if i'm entering '0'(zero), it'll be present in table as 0.00
now my problem is when i try to retrieve the records from this table using adodb recordset and then try to add the values of these fields, i'm getting an " INVALID USE OF NULL" message when the field values are 0.00
i've used the following code
DIM totdrbalance AS Double
If rs.State = adStateOpen Then rs.Close
str = "select delcharge,cramt from table1 where custid=" & Val(frmreport.txtcust.Text) & " "
rs.Open str, adoConn, adOpenDynamic, adLockOptimistic, adCmdText
totdrbalance = rs.Fields(0).Value + rs.Fields(1).Value
when i run the program i'm getting "null" assigned to rs.Fields(0).Value and rs.Fields(1).Value.
hence it seems addition is not taking place. what should i do to make these receive the value as 0.00 itself rather than null and perform the addition.
plz suggest a solution to this as soon as possible.its really urgent. what is it that i'm missing here.....
anybody has a solution for this plz help me at the earliest......
thanx in advance
ameena.
94; Invalid Use Of Nulls Error
I am trying to load a field with data from an MS Access DB and I keep getting this error. How can I avoid this?
Thanks,
Jeff
Invalid Character Error
Hello all,
I'm having problem with validating a text box with VBScript.
I have the following code in the cmdSubmit_OnClick sub...
If*(Not IsNumeric(Document.frmLogin.txtAge.Value))*Then
MsgBox*"You*must*enter*a*number*for*your*age."
Exit*Sub
End*If
I keep getting the following error, Error: Invalid Character. I've seen this work before, can someone tell me what I might be doing wrong? If anyone has another suggestion on how to validate if the text box contains numeric characters, then I'd be thankful if you let me know.
Thanks
Invalid Use Of Null (Error 94)
My code is getting the error above.
The part that is giving the error is
txt1paidamt.Text = rs.Fields("#1 Paid Amount")
txt1paiddate.Text = rs.Fields("#1 Paid Date")
txt2paidamt.Text = rs.Fields("#2 Paid Amount")
txt2paiddate.Text = rs.Fields("#2 Paid Date")
txtrepairs.Text = rs.Fields("Repairs")
txtnotes.Text = rs.Fields("Notes")
txtother.Text = rs.Fields("Other")
-------------------------------------------------------------------
Private cn As ADODB.Connection
Private rs As ADODB.Recordset
Private Sub Form_Load()
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:Documents and SettingsAdministratorDesktopSTGSTGDB.mdb"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "T_all", cn, adOpenKeyset, adLockPessimistic, adCmdTable
Set cn = Nothing
Call fillfields ' sub below
End Sub
Public Sub fillfields()
If Not (rs.BOF And rs.EOF) Then
txtfname.Text = rs.Fields("First Name")
txtlname.Text = rs.Fields("Last Name")
txtstreet.Text = rs.Fields("Street")
txtcity.Text = rs.Fields("City")
txtstate.Text = rs.Fields("State")
txtzip.Text = rs.Fields("Zip")
txtmedicare.Text = rs.Fields("Medicare #")
txtmedicaid.Text = rs.Fields("Medicaid #")
txtsecondinfo.Text = rs.Fields("Secondary Info")
txtdr.Text = rs.Fields("Dr #")
txtdrname.Text = rs.Fields("Dr Name")
txtproduct.Text = rs.Fields("Product")
txtserial.Text = rs.Fields("Serial #")
txt1paidamt.Text = rs.Fields("#1 Paid Amount")
txt1paiddate.Text = rs.Fields("#1 Paid Date")
txt2paidamt.Text = rs.Fields("#2 Paid Amount")
txt2paiddate.Text = rs.Fields("#2 Paid Date")
txtrepairs.Text = rs.Fields("Repairs")
txtnotes.Text = rs.Fields("Notes")
txtother.Text = rs.Fields("Other")
End If
End Sub
Invalid Character Error
Hi Everyone,
What is wrong with the variable in this VBScript code? I keep getting an invalid character error in this line:
strNewID = rs("MemberID")
Here is the code.
Code:
Dim strNewID
rs.Open "SELECT ID, MemberID FROM Members WHERE ID = " & NextID & "", mcnAP, 1, 3
strNewID = rs("MemberID")
I would appreciate any help. Thanks.
Error: Invalid Format!
Have an error: says that my file is corrupt and must reinstall the program. Weird thing is... it works in Windows 2000!!!
Will give further details...
|