Shouldn't WebBrowser1_DocumentComplete Happen Only Once?
Hi, I have a program that displays a popup message when the webbrowser control finishes loading a page. The problem is I get between 3-5 messages as the page loads, like its loading 5 pages.
I use the procedure for "WebBrowser1_DocumentComplete" so I figured once the entire page is done, this will run but it runs multiple times. Is there anyway to limit this to runs once at the end of the page download? the popup is displaying information it reads from the page and the first 1-2 messages are blank becuase the page hasnt loaded that far yet. any help?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
WebBrowser1_DocumentComplete Help
here's my code
Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Application) Then
If URL = "http://www.domain.com/user.php?=" & List1.List(List1.ListIndex) Then
WebBrowser1.Document.All.subject.Value = "Text to enter"
WebBrowser1.Document.All.mailbody.Value = "Text to enter"
WebBrowser1.Document.getElementById("messageForm").submit
ElseIf URL = "http://www.whatever.the.url.is.after.submit.com" & List1.List(List1.ListIndex) Then
If List1.ListIndex <> List1.ListCount - 1 Then
List1.ListIndex = List1.ListIndex + 1
GoCodeNav_Click
End If
End If
End If
End Sub
Anyone know why when the program gets to ElseIf URL = "http://www.whatever.the.url.is.after.submit.com" & List1.List(List1.ListIndex) Then , it just exits the sub? It's skipping this line of code:
Code:
If List1.ListIndex <> List1.ListCount - 1 Then
List1.ListIndex = List1.ListIndex + 1
GoCodeNav_Click
End If
Stopping WebBrowser1_DocumentComplete On First Time(Resolved)
Hello, how can I stop the web browser's document complete code from running the first time? This is how I tried it without success:
VB Code:
Private Sub Webbrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) Dim i As Integer MyCount = MyCount + 1 txtDisplay.Text = "" If count = 1 Then Rid_Aol = True End If If Rid_Aol = False Then Set objHTML = WebBrowser1.Document prog.Max = objHTML.links.length For i = 10 To objHTML.links.length - 9 txtDisplay.Text = txtDisplay.Text & " " & objHTML.links.Item(i).innerText prog.Value = i Next i If txtDisplay.Text = "" Then txtDisplay.Text = "No Matches Found;" & vbCrLf & "Check spelling of word searched." End If Set objHTML = Nothing lblShowStatus.Caption = "Done." prog.Visible = False Else Exit Sub End IfEnd Sub
Auto Forum Submit Without WebBrowser1_DocumentComplete?
I'm searching some way to do it, but not like this:
http://vbforums.com/showthread.php?t...t=forum+submit
I found it but the thing is, that it's very slow because the program need to load the html -->and<-- all images and tables there.
If were any way to do it without using WebBrowser control...like using winsock just to send the values it would be great or else i will do it just with WebBrowser control
WebBrowser1_DocumentComplete + ... Do Not Work With PDF File Loading, Why?
I created a VB (6.0) project and added a WebBrowser control to the form. I wish to automate the process of dowloading PDF documents, with sequential naming. So, I monitored the "WebBrowser1_DocumentComplete" event. I found out that this event triggered (i.e. indicated 'document complete') before the PDF document was loaded or fully loaded.
Then, I tried to use:
1) WebBrowser1_DownloadComplete
2) Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE
Both also showed the similar problem to that of WebBrowser1_DocumentComplete.
Would anyone pls advise WHY?
Is there any other 'method' to monitor whether a PDF document is COMPLETELY downloaded.
Many Thanks ...
I Know That I Shouldn't Ask But . . .
Hello all,
All morning I'm trying to figer out how to do something,
I was wondering if one of you wold like to give a suggestion.
I got a text box and I break it a part if there is spaces,
so now I got an array with all the words.
Now I need to make a string with all the
order combination of the words, for example -
"AAA BBB CCC"
so my array is
MyArr(0) = "AAA"
MyArr(1) = "BBB"
MyArr(2) = "CCC"
should give me a string with
"AAA BBB CCC ! AAA CCC BBB ! BBB AAA CCC ! _
BBB CCC AAA ! CCC AAA BBB ! CCC BBB AAA"
I don't know how many words I'll get to deal
with but this is what I found out -
for 2 there will be 2 results
for 3 there will be 6 results (3[#of words]*2[the result from above])
for 4 there will be 24 results (4[#of words]*6[the result from above])
for 5 there will be 120 results (5[#of words]*24[the result from above])
and so on . . .
Please, I'm busting my brain all morning, just need a lead . . .
Thanks,
Eddie.
Why Shouldn't?
It has always been advised in the history of programming
not to use the goto statement?
But, I found it very useful in some situations.
Then, Why shouldn't the goto statement used in programming?
Can anybody give me some convincing reasons...
Thanks in advance.
Saran.
Shouldn't This Work?
Sorry I couldn't think of a better title, but anyways this is the part which I am having a problem with in my code.
Code:
'this code is in a module
Public Function loadData(frm As Form)
for i = 0 To 3
frm.Group(i).Text = fstArray(random) 'this part is highlighted
Next i
End Function
Code:
sub form_load
Group = Array(text1, text2, text3, text4)
Call loadData(form1)
End Sub
That is basically the code with the problem. I'm trying to make it so the for loop gives:
me.text1.text = "whatever..."
I hope you understand what I mean. Thanks
Getting An Error That I Shouldn't?
I have four ASP pages all linked. The first asks for data and if valid passes it to the second. (They are small due to the size of the CE device I have.) The second to the third and the third to the fourth, which then goes back to the first to restart the process.
In all of them, I use the redirect command and it works just fine except for the next to last one. I have the following line in an ASP.
Response.Redirect "MovePalletP4.asp?sPallet=" & sPalletID & "&sPlant=" & sPlant & "&sWarehouse=" & sWarehouse & "&sRow=" & sRow & "&sColumn=" & sColumn & "&sLevel=" & sLevel
It works on my laptop. When I do this line on the CE device, I get the following error: "400 Bad Request Due to malformed syntax, the request could not be understood by the server. The client should not repeat the request without modifications." Except that when I just go to the address line, with the statement I created from the line above, and press enter, it works!
Does anyone know why I have to do this extra step to get it to work? Obviously, I want to get rid of that so it properly goes to the 4th ASP page.
Thanks!
turlough
Why One Shouldn't Use End Statement?
Hi all!
This may be a stupid question, but anyway. I've read a couple of posts on how one should exit the program. All of them (and also MSDN site) suggested, that when exiting the program, one should unload all forms instead of using 'End statement'.
I'm wondering why I shouldn't use 'End'? In my ExitApp procedure I first make sure everything is saved and if it is then I call 'End'. Why that's wrong?
Thanks,
Bostjan
This Shouldn't Be That Hard!!
i am trying to open an oridinary picture and save it in ThumbNail Form...
So i am opening it in a PictureBox (autosize=true), then loading it into an ImageBox (stretch=true) that is 20% in size of the pictureBox, but when i save it from the ImageBox (with the SavePicture Function), it's saving in its original size!!! (not the one currently in the imageBox)... why??
Not only this, but the quality is getting worse!!
Any ideas?? Maybe it could be done thru the "GetRegion" API???!!!
This Shouldn't be that hard!!!
Thanx...
Txt Box Disappears - But It Shouldn't!
I have the following code in the tree view mouse down.
When I step through and reach the line
Code:txtGrade.Left = (frmGrading.Width 2) - (txtGrade.Width 2)
the text box disappears, and I don't know why!!!
I am trying to centre the text box regardless of the length of text in it.
Code:Private Sub tv1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'...put users choice in the text box
Dim n As MSComctlLib.Node 'Since other object types may have nodes
Dim strTemp As String
Me.ScaleMode = 3
Set n = tv1.HitTest(x, y)
If Not n Is Nothing Then
strTemp = "Grading syllabus for " & n.Text
txtGrade.Width = frmGrading.TextWidth(strTemp) + (GetSystemMetrics(SM_CXBORDER)) * Screen.TwipsPerPixelX
txtGrade.Text = strTemp
txtGrade.Left = (frmGrading.Width 2) - (txtGrade.Width 2)
End If
Set n = Nothing
End Sub
Edited by - andy99 on 8/17/2003 7:25:37 AM
Pictures Shouldn't Be Included In The Exe
Hi,
when i compile my project, he puts all image files in the exe. (which makes my exe verry big)
but i want that he doesn't put them in de exe but read them from the file adress that is under image1.picture.
and i DON'T want to put everywhere: picture1.picture = loadpicture " ...
any idea's?
Skipping Some Code Out That It Shouldn't
Hey everyone,
I'm making a retail system for my college project. I made a prototype of this system and everything worked. I then went on to make the real thing, using graphics for the interface and doing more complicated commands like changing a picture in the centre of the screen to use as a help window.
Anyway, in the prototype, everything worked. I made a purchase button which did the following:
-checked which game was being sold, and which member was purchasing it,
-took 1 off the total stock amount,
-asked for the money the customer was handing the user through an input box,
-returned how much change was needed through a message box,
-added all the sales details to a Daily Sales List, e.g. what game was bought, at what price, at what time etc,
-checked how many points the game was worth, checked how many points the member had, and added them together and replaced the member's old points with this new figure,
-if this figure added up to 500 or more, it brought up a message box telling the user that they need to print out a voucher,
-then, it took 500 points off the member's points, ready for them to start collecting for a new voucher again,
-if the member didn't reach 500 however, it just ended.
All this worked perfectly using the following code (this is just some of it to get an idea of what I have done)
Code:
Sheets("MainInterface").Select
MemberNumber$ = Range("N26")
Sheets("Members").Select
Range("MemIDs").Find(MemberNumber$, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False).Activate
ActiveCell.Offset(0, 5).Select
ActiveCell = TotalPoints%
'This part changes the member's current points to their new value.
Sheets("Games").Select
Range("H42").ClearContents
Range("I42").ClearContents
Sheets("Interface").Select
'This part goes back to where it pasted the two values for adding, and deletes them.
If TotalPoints% < 500 Then GoTo End_Subroutine:
'If the member's new points is less than 500, the Macro ends.
If the points was 500 or more it did what I said. This all worked.
This time however, when I copied and pasted the code into the new one, I changed the cell names and table names so it all works apart from one thing. It keeps going to End_Subroutine even if TotalPoints% = 500 or more. I did it the first time in Excel 98, and this time in Excel 2000. I think something might of changed in Excel 2000 that I don't know of. Could you please tell me how to get it to do what I want? I've been trying to fix it all day >.<
Thanks a lot everyone in advance
Little Help, Shouldn't Take But 2 Mins Of Your Time
Ok I have ' a part of my code, that suspoed to deterime that if the qunaity is great than what we have in stock, a messgae should pop, up and say so, then end the operation. At it's current state, it always ends the operation even if there isn't a problem. here is my code:
code:--------------------------------------------------------------------------------
Code:
Private Sub cmdU_Click()
Dim catnumber As String
Dim quanty As Integer
Dim z As String
Dim feild As record
' open the file
Open "a:charile2.txt" For Input As #2
Do While Not EOF(2)
' this is in there to see is the S code is working right
Input #2, catnumber, quanty, z
For x = 1 To LOF(1) / Len(feild)
Get #1, x, feild
If Trim(feild.Catalog) = catnumber Then
If z = "S" Then
feild.Quanity = feild.Quanity - quanty
End If
If z = "R" Then feild.Quanity = feild.Quanity + quanty
If z = "D" Then
feild.Quanity = feild.Quanity - quanty
feild.status = "D"
End If
'If quanty > feild.Quanity Then
'MsgBox "Easy there party animal, check that number again."
'End
'End If
' put it to the invenotry file
Put #1, x, feild
End If
Next x
Loop
Close #2
Kill "a:charile2.txt"
Open "a:temp" For Random As #3 Len = Len(feild)
y = 1
For x = 1 To LOF(1) / Len(feild)
Get #1, x, feild
If feild.status <> "D" And feild.Quanity <> 0 Then
Form2.Print y
Put #3, y, feild
y = y + 1
End If
Next x
Close #1
Close #3
Kill "a:data"
Name "a:temp" As "a:data"
Open "A:data" For Random As #1 Len = Len(feild)
End Sub
--------------------------------------------------------------------------------
Anyhelp would be apprecitated.
Here it is up close.
Code:
'If quanty > feild.Quanity Then
'MsgBox "Easy there party animal, check that number again."
'End
'End If
' put it to the invenotry file
Put #1, x, feild
Settings That Shouldn't Be Changed
Hi all!
I'm trying to find a way to write program settings that the user could not change (date of installation for example).
Could you give me some advice on what would be the best solution?
Thans very much,
Bostjan
Window Resizing When It Shouldn't
I have a VB6 MDI application. One of the forms loads maximised and is meant to stay that way. When a user right-clicks on a cell in an iGrid on this form a new child form gets loaded and shown. The only problem is that the instant the new form is shown, the originating form reduces in size and has to be maximised manually.
Can anyone explain why this happens?
Desperately Need Help Shouldn't Be That Tough For Someone Who Knows What They'r Doing
okay heres my situation
this is the code im using for a clock to check the time in other areas of the world
Private Sub cmdbangkok_Click()
lblwhotime.Caption = "Bangkok Time"
lbltime.Caption = Format(DateAdd("h", 16, Time), "HH:MM:SS ampm")
however when the time updates the new desired time goes away and the result is the time i want only stays for 1 second
is there any line of code i could add tothis or to my timer so that the new time i want remains current
PLEASE HELP !!!
thanks alot
Array Shouldn't Be EMPTY!!!
please tell me why it says the array "Numbers" is empty . . .
Private Sub Form_Load()
Dim Numbers(0 To 5) As Integer
Numbers(0) = 102
Numbers(1) = 5
Numbers(2) = 14
Numbers(3) = 609
Numbers(4) = 407
Numbers(5) = 86
End Sub
Private Sub cmdsort_Click()
Dim Lower As Integer
Dim Sortloop As Integer
Dim Temp As Integer
Dim Sortpoint As Integer
Lower = LBound(Numbers)
Do Until Lower > UBound(Numbers)
Lower = (Lower * 3) + 1
Loop
Do Until Lower = LBound(Numbers)
Lower = Lower / 3
For Sortloop = (Lower + LBound(Numbers)) To UBound(Numbers)
Temp = Numbers(Sortloop)
Sortpoint = Sortloop
Do While (Numbers(Sortpoint - Lower) > Temp)
Numbers(Sortpoint) = Numbers(Sortpoint - Lower)
Sortpoint = Sortpoint - Lower
If Sortpoint < Lower Then
Exit Do
End If
Loop
Numbers(Sortpoint) = Temp
Next Sortloop
Loop
End Sub
thanx
Type Mismatch, But It Shouldn't Be...
I have a usercontrol that I am passing an object into. I've taken steps to make sure that only listviews are passed in. I also have a privately declared Listview in the control. When I run the following line on my computer, it works perfectly:
Set mLV = l
l is the Object, mLV is the private Listview.
But when I run the OCX on another computer, I get a type mismatch on that line.
Both the OCX, and the test project reference the Windows Common Controls 6 SP4 Listview.
Webbrowser...shouldn't Be Complicated..
my program searches on a site...it uses strings built into a website and loads the results in webbrowser control..well say I type in 'austin' then hit GO...it searches for it..but then if I hit GO again..it just loads the same page and doesn't actually search again...here you might not understand..if i hit the search button in the webbrowser window it actually does another search..but if i hit my form button to search again it just reloads the page without actually searching..heh
Code:
Option Explicit
Private Sub Command1_Click()
If Combo1.Text = "Player" Then
WebBrowser1.Navigate "http://www.gametiger.net/search?player=" + Text1.Text + "&game=cstrike"
End If
If Combo1.Text = "Map" Then
WebBrowser1.Navigate "http://www.gametiger.net/search?map=" + Text1.Text + "&game=cstrike"
End If
If Combo1.Text = "Address" Then
WebBrowser1.Navigate "http://www.gametiger.net/search?address=" + Text1.Text + "&game=cstrike"
End If
If Combo1.Text = "Server" Then
WebBrowser1.Navigate "http://www.gametiger.net/search?server=" + Text1.Text + "&game=cstrike"
End If
End Sub
Private Sub Form_Load()
WebBrowser1.Navigate "about:blank"
End Sub
Private Sub Text1_Click()
Text1.Text = ""
End Sub
Private Sub Text1_GotFocus()
Text1.Text = ""
End Sub
RegEnumValue Again...(actually Shouldn't Be Too Hard)
while I got the regEnumKeyEx to work, the regEnumValue won't. What's wrong?
As I see it the two loops are exactly the same and should work
the same too.
What did I miss here? Must be something simple...
VB Code:
Option Explicit 'FUNKTIONENPrivate Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPrivate Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, phkResult As Long, lpdwDisposition As Long) As LongPrivate Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As LongPrivate Declare Function RegDeleteValue Lib "advapi32.dll" Alias "RegDeleteValueA" (ByVal hKey As Long, ByVal lpValueName As String) As LongPrivate Declare Function RegEnumKeyEx Lib "advapi32.dll" Alias "RegEnumKeyExA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, lpcbName As Long, lpReserved As Long, ByVal lpClass As String, lpcbClass As Long, lpftLastWriteTime As FILETIME) As LongPrivate Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, lpReserved As Long, lpType As Long, lpData As Byte, lpcbData As Long) As LongPrivate Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As LongPrivate Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As LongPrivate Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long 'KONSTANTENPrivate Const ERROR_SUCCESS = 0& Private Const HKEY_CLASSES_ROOT = &H80000000Private Const HKEY_CURRENT_CONFIG = &H80000005Private Const HKEY_CURRENT_USER = &H80000001Private Const HKEY_DYN_DATA = &H80000006Private Const HKEY_LOCAL_MACHINE = &H80000002Private Const HKEY_PERFORMANCE_DATA = &H80000004Private Const HKEY_USERS = &H80000003 Private Const SYNCHRONIZE = &H100000Private Const KEY_CREATE_LINK = &H20Private Const KEY_NOTIFY = &H10Private Const KEY_ENUMERATE_SUB_KEYS = &H8Private Const KEY_CREATE_SUB_KEY = &H4Private Const KEY_SET_VALUE = &H2Private Const KEY_QUERY_VALUE = &H1Private Const STANDARD_RIGHTS_ALL = &H1F0000Private Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE)) 'TYPEN'CreateExPrivate Type SECURITY_ATTRIBUTES nLength As Long lpSecurityDescriptor As Long bInheritHandle As LongEnd Type'EnumKeyExPrivate Type FILETIME dwLowDateTime As Long dwHighDateTime As LongEnd Type Sub RegRunLesen() Dim strKeyFolder As StringDim lngKeyHandle As LongDim strValname() As StringDim lngValType() As LongDim bytValData As ByteDim lngLpcData As LongDim intBound As IntegerDim fltTime As FILETIMEDim str As StringDim lngRet As Long strKeyFolder = "SoftwareMicrosoftWindowsCurrentVersionRun"'strKeyFolder = ""lngKeyHandle = F_OpenKeyLM(HKEY_LOCAL_MACHINE, strKeyFolder) intBound = 0 'This loop works perfect:Do ReDim strValname(intBound) ReDim lngValType(intBound) strValname(intBound) = String(255, 0) If lngRet = RegEnumKeyEx(lngKeyHandle, intBound, strValname(intBound), 255, 0, 0, 0, fltTime) = ERROR_SUCCESS Then Debug.Print "enumKey error or end" Exit Do Else Debug.Print strValname(intBound) End If intBound = intBound + 1Loop intBound = 0 ' :( :( :(This loop won't work at all :( :( :( Do ReDim strValname(intBound) strValname(intBound) = String(255, 0) lngLpcData = 255 If lngRet = RegEnumValue(lngKeyHandle, intBound, strValname(intBound), lngLpcData, 0, 0, 0, 0) = ERROR_SUCCESS Then Debug.Print "enumValue error or end" Exit Do Else Debug.Print strValname(intBound) Debug.Print lngLpcData End If intBound = intBound + 1Loop ' :( :( :( Debug.Print "ende" End Sub Function F_OpenKeyLM(lngBaseFolder As Long, strKeyFolder As String) As Long Dim lngKeyHandle As LongDim lngRet As Long lngRet = RegOpenKeyEx(lngBaseFolder, strKeyFolder, 0, KEY_ALL_ACCESS, lngKeyHandle) If lngRet = ERROR_SUCCESS Then RegOpenKeyEx lngBaseFolder, strKeyFolder, 0, KEY_ALL_ACCESS, lngKeyHandleElse Debug.Print "error opening key"End If F_OpenKeyLM = lngKeyHandle End Function
Shouldn’t This Be Easy?
Table 1 Table2
------------------------------ --------------------------
/ PK /Composit FK / Whatever / / Composit PK / Whatever /
------------------------------ --------------------------
/ 1 / A / 1 / asdfasdf / / A / 1 / dsfsfdsf /
/ 2 / A / 1 / sdfasdfs / / B / 2 / sfasfdfd /
/ 3 / B / 2 / sdfsdfsd /----------/ C / 3 / dsafdsfg /
/ 4 / B / 2 / sdfsdfdf / / --------------------------
/ 5 / C / 3 / dfgfgsdg //
/ 6 / C / 3 / dsgfsgdd /
/ 7 / D / 4 / sdfggsdg / <---Obviously A Violation Of Referential
------------------------------- Integrity
<I Am Using SQL Server 2000>
How Do I Write A SQL Statment To Get:
All The Records From Table 1 Where
The Composit FK Does Not Have A Related PK?
Thank-You In Advanced
Brian
Edited by - Shandy on 4/16/2004 5:10:34 AM
Access: Delete Deletes, But Shouldn't :-)
Hi!
I have following code:
dim rs as DAO.recordset
set rs = CurrentDb.OpenRecordset("select * from table")
'move to certain row
'...
rs.delete
This deletes the data from the table..i just want it to be deleted from my "local" recordset.
regards, martin
Getting A Type Mismatch Error When I Shouldn't
Here is the relevant code, I get the type mismatch on the set recrodset line:
Code:
strSQL = ""
strSQL = strSQL & "SELECT Consol.LOG, Consol.NR, Consol.NCO, Consol.NCH, Consol.TT "
strSQL = strSQL & "FROM Consol "
strSQL = strSQL & "WHERE (((Consol.AgentLogin)=""" & strAgentID & """) "
strSQL = strSQL & "AND ((Consol.Date)=#" & dtTemp & "#));"
Set rstAgentData = dB.OpenRecordset(strSQL, dbOpenSnapshot)
Consol.Agentlogin is a text field and Consol.Date is a Date/Time field so I'm baffled as to why I would get a type mismatch.
I've even output the string and put it in a query just to check and no problemo.
Any insight would be appreciated.
Procedure_Change() Shouldn't Run At Initialize - Hopefully Easy
I can't figure out how to set the code so this procedure doesn't run with the "Private Sub UserForm_Initialize()" statement. Here's a sample:
Code:
Private Sub cbo_material_Change()
'Search material string for "01" and set finish
If InStr(cbo_material.Text, "01") > 0 Then
cbo_finish.Text = "HRDN: R/C 56-58"
MsgBox "Finish has been assigned."
cbo_finish.SetFocus
End If
End Sub
When a user selects a certain item in a combobox, the code sets the text in another combobox and tells the user. However, when we start this macro with "01" in cbo_material, for example, it pops up the msgbox twice when it shouldn't at all. What should I do to get around this? Thanks!
Random Character In A Report That Shouldn't Be There
So I have this report that is basically serving as a receipt, and everything is working fine, but there is a "-" character that appears on it below a label. It is on the Print preview and on the actual print out, but its not on the Report Design.
Now, it doesn't do it on my machine that I devolped it on, but it does it on the machine that our End User uses. We both have the same version of Access, so I don't really know what is going on.
Any ideas?
Any Reason I Shouldn't Run A Program As A Service In NT?
Since I can't get my program to run from the virus scan program as it should, I'm considering creating it as a service with a timer that checks once/hour and updates as needed. I've found several code examples
(http://www.planet-source-code.com/vb...txtCodeId=3585)
It is my experience that sometimes just because you CAN do something doesn't mean you SHOULD do it. I'm curious if anyone has any experience with this and if it would be a good idea or not.
The program would run on NT4 servers and clients, read the registry and update a database periodically with no user interface.
Thanks,
Jules
Questions For VB Newbie (shouldn't Be Too Hard)
I am new to VB, and I have some questions that I don't think will be difficult to answer for someone with experience. Any help is much appreciated.
Okay, I have two sheets in one Excel workbook, entitled Schedule and Defects.
On the defects page, it has a numerical listing of defects in one column, along with columns for Developer1, Developer2, and End Date.
On the Schedule sheet, in left-most column is the name of each developer, and along the top are the dates for the next month. At the cell where a developer and a date meet, there will be the defect that the developer worked on that date.
Okay, now that the background is out of the way. I need to go through each defect on the Defects sheet, and find when and by whom they are worked on the Schedule sheet. Part of the difficulty lies in the fact that on the Schedule, each cell has more than just the defect number in it. So if the defect number is 1234, the cell might say something like [1234-A]9874-H. I need to somehow just search for the defect as a substring of each string in every cell.
Anyway, once I find a defect in the schedule, I need to copy the developer name (from column A in the Schedule sheet) into the Developer1 column on the Defect sheet. I also need to continue searching the Schedule sheet, and if a different developer also has the defect in his/her row, I need to copy his/her name into the Developer2 column for that defect.
Lastly, I need to keep track of when the last date that the defect is worked. So every time I find the defect in the schedule (which falls between B3 and AZ18), I need to check and see if it is later (or further right in the matrix since is goes from high date to low date) that any other occurence of that defect. Once I find the latest occurence, I need to put it into the End Date cell for that defect in the Defect sheet.
I hope this isn't too confusing and that somebody can PLEASE help me with this. Thanks for any help in advance.
2nd Party Combo Box (shouldn't Be That Hard)
I have 2 forms.
In one form I have ListBox with an Add button nearby. When I click on the Add button, it pops me out an InputBox and when I jot something in it and press Enter, the text will be added to the listbox. Now, in that form when I click on an OK button, it adds everything in the listbox into another form's ComboBox. Then I open that form and the contens are there. My problem is that when I unload the forma and then load it again, there is nothing in the ComboBox.
I don't ant to save it to a text file.
Thanks for any feedback you guys!
RsCustomers.RecordCount < 1 = True, Shouldn't
Hey everyone, I've got a B-I-G problem here and I can't figure out how to solve it, so please help me if you can. It goes like this:
I have an SQL query to get all records of a certain company in the database, and in the mean time I get its ContactPersons (CP). I check if there are records, if not, I try to get the company's info without CPs (if he doesn't have any, the first statement returns 0 of course). And if that also doesn't exist, I send a messagebox to say that.
Here's the code:
Code:If rsCustomers.State = adStateOpen Then
rsCustomers.Close
End If
rsCustomers.Open "SELECT Customers.*,CPs.CPID,CPs.CompanyID FROM Customers,CPs WHERE Customers.Nummer=CPs.CompanyID AND Customers.Nummer=" & mvarCID, cn1, , , adCmdText
If rsCustomers.RecordCount < 1 Then
rsCustomers.Close
rsCustomers.Open "SELECT * FROM Customers WHERE Customers.Nummer=" & mvarCID, cn1, , , adCmdText
End If
If rsCustomers.RecordCount < 1 Then
MsgBox "There is no company with this CompanyID.", vbOKOnly, "Invalid CompanyID"
Exit Sub
End If
...
Please help me if you can, the mvarCID is correct and the RecordCount is every time equal to -1.Thanks
Search before you ask - if you don't know where to search, ask before you search
Edited by - breakfast3001 on 5/10/2003 1:04:03 PM
CommonDialog1.Flags = CdlOFNOverwritePrompt Shouldn't Be Used In SAVE
I use
CommonDialog1.Flags = cdlOFNOverwritePrompt
in SAVE AS, then i can see if there is an existing file, but:
i cant or i shouldn't use it with SAVE, because when the user
clicks on SAVE no window should pop up, its a silent save so:
if its a silent save, how can i know if the user is overwriting
an existing file?
(the user could be using the same file name and overwriting all the info he had in the old file)
Thanks
JCI
Problem: Checkbox Click Event Being Called When It Shouldn't Be
My program has 4 checkboxes, and based on various data that changes on user input, the checkboxes become checked or unchecked.
My problem is that when my program sets the checkbox.value to 1, that seems to make VB think I clicked the checkbox, which runs the click() event.
How do I prevent the program from doing that, or how would I go about validating whether or not it was actually clicked?
Shouldn't I Be Able To Access A Recordset (created In A Class) From A Form?
In CMyClass I have declared . . .
Private rsMyRS As ADODB.Recordset
Then in Private Sub Class_Initialize() . . .
Set rsMyRS = New ADODB.Recordset
Then in MyForm I have declared . .
Private MyClass As CMyClass
And in Private Sub Form_Load() . .
Set MyClass = New CMyClass
Shouldn't I be able to access MyClass.rsMyRS!Entity from a procedure in MyForm?
Thanks for any input,
JR
Why Would This Happen
Hi all
I have a strange problem and can't seem to figure it out, i have a Vsflexgrid on my form "grdjournal" in col 2 i store currency, i then use the following code to add up the figures and display it in a label "lblTotal".
Code:
Private Sub cmdSubTotal_Click()
lblTotal.Visible = True
grdJournal.SubtotalPosition = flexSTBelow
grdJournal.Subtotal flexSTSum, -1, 2, "$", vbRed
lblTotal.Caption = Format(grdJournal.TextMatrix(50, 2), "Currency")
End Sub
But for some reason it is rounding the total to the nearest whole number, for instance, in col 2
$10,50
$10,50
$10,50
will display $31,00 instead of $31,50.
Please can someone advise me as to what i might be doing wrong.
Many thanks
Why Would This Happen
Hi
I am using an access database, and on my form i have two command buttons, one command button copies data from a Table called "Sales1" into a table called "SalesHist" the other command button then deletes the same data from "Sales1", the part that is confusing me is that the queries work provided i quit my app between buttons. So if i use command1 to copy the data it works fine, if i quit the app and then use command2 the correct records are deleted and all is fine. But if i click on command1 and then 10 seconds later command2 the records are deleted from both tables, and there are'nt many records it does the same with 10 or 2.
Code:
Private Sub cmdCustomers_Click()
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim sSQL As String
Dim tmpSQL As String
Set MyConn = New ADODB.Connection
Set MyRecSet = New ADODB.Recordset
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:pospos.mdb;"
MyConn.Open
tmpSQL = "INSERT INTO SalesHist (Tbl_No, Qty, Description, Price, Dates) SELECT Tbl_No, Qty, Description, Price, Dates FROM Sales1 WHERE Tbl_No = '" & lblTabNo.Caption & "'"
MyConn.Execute tmpSQL
MyConn.Close
End Sub
Code:
Private Sub cmdTender_Click(index As Integer)
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Dim sSQL As String
Set MyConn = New ADODB.Connection
Set MyRecSet = New ADODB.Recordset
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:pospos.mdb;"
MyConn.Open
sSQL = "DELETE Tbl_No, Qty, Description, Price, Dates FROM Sales1 WHERE Tbl_No = '" & frmMain.lblTabNo.Caption & "'"
MyRecSet.Open sSQL, MyConn, adOpenStatic, adLockReadOnly
Unload Me
End Sub
Many thanks
Why Does This Happen?
Hi all,
I'm having a minor problem with my application. What I have is a progress bar that shows the progress of the current sub being performed. Now, this sub takes 15+ seconds to complete (depending on the listcount in the listbox). It is interacting with a third party app, which is why it takes so long.
Anyway, it works all fine and dandy...until you click on another application. When you try to switch to a new application or anything of the nature, the application temporarily 'locks up' until the sub is finished running. I've attached a picture of what it looks like when it is 'locked up'. The progress bar stops moving and if I was to go back and click on the app again, it would turn all white and say (Not Responding) in the title bar until the sub was finished. Once it finishes, everything goes back to normal. I'm thinking it's some sort of refresh/redraw problem, but I'm not sure. I have a Me.Refresh at the end of each 'Next x' in the sub (The sub runs a full time for each item in the list box) and in my form loud I have a Me.AutoRedraw=True but neither of those work.
Any ideas?
What Happen Here?
Hi, i have a public sub in a module that i call.
when i put this:
call seteatoolbar(1) it doesn't work
when i put this:
msgbox "wait"
call seteatoolbar(1) it work correctly
when i put a message box before or after the call it works right.
do you have an idea of what's happening?
Anybody Else Had This Happen Lately
I'm having some serious difficulties in running Visual Studio/VB98. While compiling and running my project. I get the dreaded "Microsoft has experienced a problem and will now be terminating yada yada yada". This has increasingly become a problem as I work from home and can't find my Visual Studio discs.. Maybe I should have just upgraded to XP Pro and installed .Net. Anyone else that has experienced difficulties feel free to reply and help me correct this problem.
Thanks
Larson
Never Seen This Happen Before ????
Hi there
We have a piece of software that's used by about 700 customers running on over 1500 machines. One particular machine of a 3 workstation network behaves in a strange way to all the others.
Its a pentium 4 running Windows XP with all the latest updates.
Here's an example of the problem
A$ = VAL("3")
but when you look in A$, you get something like 2.99999999997
This happens for nearly every whole number, I can understand if the val operation was performed on a floating point, but not on an integer.
The other machines on their network run fine and they all run the same EXE of a file server.
Appart from replacing the machine, I have no idea on what to do.
Anyone come across this problem?
Cheers
Simon Luce
Why Would This Happen
Hi all
I have a strange problem and can't seem to figure it out, i have a Vsflexgrid on my form "grdjournal" in col 2 i store currency, i then use the following code to add up the figures and display it in a label "lblTotal".
VB Code:
Private Sub cmdSubTotal_Click() lblTotal.Visible = True grdJournal.SubtotalPosition = flexSTBelow grdJournal.Subtotal flexSTSum, -1, 2, "$", vbRed lblTotal.Caption = Format(grdJournal.TextMatrix(50, 2), "Currency")End Sub
But for some reason it is rounding the total to the nearest whole number, for instance, in col 2
$10,50
$10,50
$10,50
will display $31,00 instead of $31,50.
Please can someone advise me as to what i might be doing wrong.
Many thanks
Why Would This Happen?
Hi
I am using an access database, and on my form i have two command buttons, one command button copies data from a Table called "Sales1" into a table called "SalesHist" the other command button then deletes the same data from "Sales1", the part that is confusing me is that the queries work provided i quit my app between buttons. So if i use command1 to copy the data it works fine, if i quit the app and then use command2 the correct records are deleted and all is fine. But if i click on command1 and then 10 seconds later command2 the records are deleted from both tables, and there are'nt many records it does the same with 10 or 2.
VB Code:
Private Sub cmdCustomers_Click() Dim MyConn As ADODB.Connection Dim MyRecSet As ADODB.Recordset Dim sSQL As String Dim tmpSQL As String Set MyConn = New ADODB.Connection Set MyRecSet = New ADODB.Recordset MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:pospos.mdb;" MyConn.Open tmpSQL = "INSERT INTO SalesHist (Tbl_No, Qty, Description, Price, Dates) SELECT Tbl_No, Qty, Description, Price, Dates FROM Sales1 WHERE Tbl_No = '" & lblTabNo.Caption & "'" MyConn.Execute tmpSQL MyConn.CloseEnd Sub
VB Code:
Private Sub cmdTender_Click(index As Integer) Dim MyConn As ADODB.Connection Dim MyRecSet As ADODB.Recordset Dim sSQL As String Set MyConn = New ADODB.Connection Set MyRecSet = New ADODB.Recordset MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:pospos.mdb;" MyConn.Open sSQL = "DELETE Tbl_No, Qty, Description, Price, Dates FROM Sales1 WHERE Tbl_No = '" & frmMain.lblTabNo.Caption & "'" MyConn.Execute sSQL Unload MeEnd Sub
Many thanks
Why Does This Happen?
hey guys, i ahve another question:
Option Explicit
Dim x As Long
Private Sub Command1_Click() ....................1
On Error GoTo aa .....................................2
If Form1.Name = "Form1" Then ....................3
x = CDbl(txt.Text) ...............................4
Print "ss" ...........................................5
aa: .................................................6
Call MsgBox("sdfsd") ............................7
Resume Next .................................. 8
End If
End Sub
ok now i will explain what's going on: First in the txt i have a string lateral not numeric, so when i press i get to line 4, an error occures and i get to line 6, msgbox is called then back to line 3, i get to 4 then error then to 6 then back to 5, ss is printed then i get to 6 and a msgbox....so i get 3 times the msgbox.
But in case txt is numeric: i press, reach 4,5,6 and get a msgbox, then resume to where? In this case i am getting the msgbox twice, why? where is the aa: resuming to.
thanks.
Does This Happen To You Too?
try this out. open a new project, maximise the form and put a cmd button or any other ctl right at the bottom of the form. then run it and maximise the form.... what do u see?
Can This Happen??
Can you change someones homepage(default location a browser goes to) without them knowing about it?? Kinda like when you are prompted to set your home page as someones web site except without prompting you just set it? Can that actually be done?? If so How? .......if you tell me how maybe i will tell you why i want to know ......i will not do anything bad with it...I promise
Why Does This Happen?
Put this line of code into a form and tell me what you get. what i get is 6.4583333, but when i do this on a calculator i get .0064583333. Why does this happen, how do i fix this?
lblpaymentout = 7.75 / (12 * 100)
Why Did This Happen?
I did my first deployment via CD today. I went to a client where I had already installed a version of my program via floppy disk.
I popped the CD in the tray, hit setup.exe, and a message appeared saying that some files were missing, and if I wanted to complete setup then I would need to re-boot the computer. I did, and when I re-started setup.exe, I got a series of messages saying that I was trying to install older dll files than what was already on the computer. It gave me the option of keeping these older files, and the setup proceesed okay.
But why did all this happen in the first place? Nothing like this happened with the floppy disks.
|