vb5prgrmr 143 Posting Virtuoso

Havoc, mayhem, problems, trouble, frustration, and broken keyboards, monitors, or other various items around your office/home and could include your knuckles...

Why? Because the pound character (#) is a wildcard character so if someone entered a password like...

123#

and someone else added a password like...

1234

or

1235

you would get all three... (Havoc!) and other characters you should watch out for (!*%) as they are also wildcard characters (not for all databases, but enough to cause you trouble, see your specific database documentation under wildcard characters for more information...)


There are many ways in which to verify a password, but what you were asking for, originally, was the strength of the password and being able to display a message...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Maybe as a sub forum of Java...

vb5prgrmr 143 Posting Virtuoso

http://lmgtfy.com/?q=vb6+password+strength+verification

BTW: the pound symbol (#) will create havoc...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes, both versions contain those... Get the enterprise!

vb5prgrmr 143 Posting Virtuoso

When you start a new standard exe program, you start out with form1. Press F5 and it runs. Use the X in the upper right corner, and it ends, but what happens in the backgound is what you need to be aware of...

So to figure this out, place debug.print "procedure name" in every event of the form...

Private Sub Form_Initialize()
Debug.Print "Form_Initialize"
End Sub

and form load and so on...

now run this program once you have all the debug.print s in there. Use ALT+Tab to change to another program and switch back, resize the form, minimize the form, then close the form with the X.

Then place a command button on the form and put unload me in its click event...

Now, what Unload Me refers to, is the current form (Me) and the command is to Unload. So unload the current form... Rerun the expermental program and instead of using the X to close the form, click the button...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Andre, the line that generates the error is in the form unload event (w.quit)...

Okay neosonic, lets take this one at a time...

>First, if the user still open the word document (opened by the program), the user is forced to close it when the form unloaded. How can I avoid this?

Hide your form, use a timer with an interval set to at least 1000 (1 second) and use the FindWindow API to check to see if the specific word application you opened is still opened. If not, unload your form to end your program, else, continue to wait.

>I want to give the user flexibility to close the document whenever they want, even after the form unloaded. I want the program to know that those word documents are still opened, so it doesn't need to call W.Quit

Prompt the user with a message box...

>Second, if the user has closed the word document (opened by the program), the program will produce run time error "the remote server machine does not exist or is unavailable" How can I avoid this? I want the program to know that those word documents have been closed, so it doesn't need to call W.Quit

Two ways, trap the error and ignore it or use the FindWindow API...

Good Luck

vb5prgrmr 143 Posting Virtuoso

First, you should never use End to end your program. You should use unload me...
Second, for readability you should use the built in constants (vbKeyUp, vbKeyLeft, vbKeyRight, vbKeyDown)...
Third, does your code work as it is??? Use the forms KeyDown event in conjunction with setting the forms keypreview property equal to True

Then there are these codes...

this one makes your picture box stay to the left...
picgoomba1.Move picgoomba1.Left - -10 = False

and this is the same as saying +
picgoomba1.Move picgoomba1.Left - -10
(picgoomba1.Move picgoomba1.Left + 10)

and then why the use of the left and top properties of the control when you are already using the move statement, which is faster as you can set all its properties (left, top, width, height) at once...

So to answer your question, when you detect a collision or "collision detection" (hint: keyword search...), you want your program to end. So as I said previously, use Unload Me

Good Luck

vb5prgrmr 143 Posting Virtuoso

Ah yes... One of the funny (or not so) undocumented things about VB... Your call to the procedure with the parens wrapped around the variable forces the value to be passed byvalue instead of byref...

Convert_NumAbbreviations_to_Numbers (Amount) 'forced byval
Convert_NumAbbreviations_to_Numbers Amount 'normal byref

Good Luck

vb5prgrmr 143 Posting Virtuoso

Why two select statements? Where is vbKeyDown? Then, when intellisence comes up for your vbKeyUp, why are you trying to set the left property and not the top property, which if you have read the intellisence is the next arguement...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Your welcome stuhawk, now if you don't mind, please mark this thread as solved...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Set a break point on the line above, run, when the program breaks, activate the locals window. Now, with the locals window activated, find the control (not your doc reference to the document contained within the control) and drill down to the document level (what your doc variable is set against). Then drill down on that to see if you have access to each iframe (look at their index numbers because I'll almost bet index starts at 1 (going from memory here)). Now with that drilled down to, can you see any further properties? If so, good. If not, then you may need another variable or two to set to each document contained within the frame...

Okay, drill down on the doc variable and see if you have the same information and once again look for the index number...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Have no idea why without seeing code but I can help you out in how to figure it out for yourself.

First, make sure Option Explicit is at the top of each code window.
2nd, place proper error handling in each and every sub, which means getting rid of any on error resume next statements...

Good Luck

vb5prgrmr 143 Posting Virtuoso

cKey is a string variable declared in the sub there jemz, and it holds the string character that is the result of the chr functions conversion of the keyascii value. Then it is used in the if statement for string comparison to see if the character is acceptable or not...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well you message box says only to input alpha or numeric (0-9, a-z, A-Z) and you are allowing a whole lot more characters than that in your code.

And while I don't normally post in threads that I think have the proper answer and should soon be marked as solved but I could not resist in not only pointing the above out, but in also giving a little lesson in readability (Jemz, Andre... Although KingWang, while yours is easier to read, the conversion from integer to string and then comparing strings takes more processing power and thus is just a bit slower than comparing numbers...)

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= vbKey0 And KeyAscii <= vbKey9 Then 'numbers 0-9
ElseIf KeyAscii >= vbKeyA And KeyAscii <= vbKeyZ Then 'uppercase A-Z
ElseIf KeyAscii >= 97 And KeyAscii <= 122 Then 'lower case a-z
ElseIf KeyAscii = vbKeyBack Then 'just in case user makes a mistak
Else
  KeyAscii = 0
End If
End Sub

PS. There is a good reason VB has all those constants... because it makes the code easier to read...

Good Luck

vb5prgrmr 143 Posting Virtuoso

check out the ZOrder Property or you could play around with the Visible Property...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, in your sub Average_Click(), you declare the variables, then set the variables equal to that of a text box but then the sub ends and those variables go out of scope, which means they cannot be used any place else.

Also, in the future, when assigning variables that are numeric in nature to that of the contents of a text box, you will want to first check to see if the value in the text box is a numeric value. After that, you will want to convert the text value to the appropriate data type of the variable...

If IsNumeric(Text1.Text) = True Then 
  iValue1 = CInt(Text1.Text)
Else
  MsgBox "oops"
  Text1.SetFocus
  Exit Sub
End If

Now, do you see where this is going? No? Well I'll show you here in a bit but first, lets talk about operator precidence...

In visual basic, multiplication before division, multiplication and division before addition and subtraction, and addition before substraction, which means, your textbox # 6 is divided by 6 before being added with the rest of the values in the other textboxes. Which equates to...

6+6+6+6+6+6/6 = 33
6+6+6+6+6+1 = 33

So to change this, you would need to use parentheses to change the operator precedence. (This is just your basic math stuff...)

(6+6+6+6+6+6)/6=6

TextAverage.Text = (CInt(Text1.Text) + CInt(Text2.Text) + CInt(Text3.Text)) / 3

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, so where did you find that info? Just in case somebody wants to go that route...

vb5prgrmr 143 Posting Virtuoso

Well, if all else fails, you can either drop back to 11 or learn just enough .BLOAT to read command line arguements to display the report you want. Although, I still wonder if you can redistribute and automate the viewer. Not the control of the viewer, the viewer application itself...

Perhaps after all of this, you will become the goto man/guru on this subject... :)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Not that this is going to help much but have you checked over at seagate? And, I'm not sure, but I believe clients would now have to have the viewer, and you would have to automate that instead of the old OCX control, but to be sure, you might want to ask around at some of the CR forums. http://search.yahoo.com/search;_ylt=AivjlEnOON7kw03Nza.E5PKbvZx4?p=crystal+report+forum&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701

Then again, it now might be a reference you need to add instead of a control. Have you checked that?

Good Luck

vb5prgrmr 143 Posting Virtuoso

Andre, I think you need to reread the OP's post, as neosonic stated...

>My problem is, after running my program several times (by using "start" command in vb6)... maybe around 100 times or so... I have got out of memory error.

Which means to me that neosonic is not releasing memory between each debugging session.

So NS, you are using the LoadPicture Function to load an image into the picture box, and then into an image list? Let me guess. You are using the image list with a ListView control to display thumbnails...

(Well if not, the following should apply anyways)

In form unload, clear the picture box by use the LoadPicture Function with no arguements...

Picture1.Picture = LoadPicture()

Then since the ListView is tied to the ImageList, you will need to "Clear" the contents of the ListView prior to clearing the contents of the ImageList...

ListView1.ListItems.Clear
ImageList1.ListImages.Clear

But all of this means that you cannot use the "Stop" button in the IDE but instead allow you form to close naturally. Meaning the code needs to run to completion in form unload.

Good Luck

vb5prgrmr 143 Posting Virtuoso

What OS? Vista? 7? What is your path? Are you in/under Program Files? You may be having a problem with redirection. Also, use Option Explicit at the top of every code window, which also brings up the point of going to Tools>Options and putting a check next to Require Variable Declaration. Double check your paths, especially if you are using App.Path as it will return C:\ if you are at the root and if not it will return C:\SomePath. Thus making you need to check to see if Right(App.Path, 1) = "\" to build your paths correctly.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, you have to put the forumulas I showed you, in the right places within that if statement...

Also Lines 6 and 8. I want you to look closely at and look at the logic of what you have going on with those if checks. Yes, I am hinting that something is wrong with your logic...

also Line2 should be Hours = Int(txtnumberofhours.text)

You need to slow down and think of the logic going on here because you have had all the information for a couple of days now and it just seems like you are wanting someone to do your work for you. You have the pieces, now just assemble them in the correct order, and you will have your solution.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Where is your if hours <= 40 then, elseif hours > 40 and hours < 50 checks?

vb5prgrmr 143 Posting Virtuoso

Without seeing your code... It is kind of hard to tell where you went wrong or where you missed something...

Good Luck

vb5prgrmr 143 Posting Virtuoso

The answer is there already... I don't know what else I can do except do your work for you!

vb5prgrmr 143 Posting Virtuoso

>If they work between 41-50 hours (which is considered as overtime), they get 40 hours of pay PLUS an extra $1.50 per hour
e.g. 45 hours (40 hours x $5.50) + (5 additional hours x $5.50 x $1.50) = $261.25
OverHours = (Hours - 40)
Hours = 40
GrossPay = (Hours * 5.5 ) + (OverHours * 5.5 * 1.5)

and

WellOverHours = (Hours - 50)
OverHours = (Hours - (40 + WellOverHours))
Hours = 40
GrossPay = (Hours * 5.5 ) + (OverHours * 5.5 * 1.5) + (WellOverHours * 5.5 * 2.5)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Actually, VB6.0 does not support a lot of icon formats that .NET does, like *.png or more than 256 colors or a size larger than 32x32. See the help files for more information or search the web for more accurate information.

Good Luck

vb5prgrmr 143 Posting Virtuoso

To attach pictures to your post, or to attach a zip file, use the go advanced button below. Then you will be given the options to attach pictures and files...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Because you are inserting a record, not returning a record. When records are returned, use a recordset. When just updating, inserting, or deleting, use either the connection object, or the command object.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Are you talking about a scrolling background, or changing the left property of a image or picture box control?

and BTW, help as a subject title is not very descriptive...

Good Luck

vb5prgrmr 143 Posting Virtuoso

your close but a few things wrong with your string concatination...

"SELECT * FROM LERNER WHERE LICENSE_NO='" & Text1.Text & "'", db,...

Good Luck

vb5prgrmr 143 Posting Virtuoso

You know what, it should actually be easier for you to use the connection object to execute you sql insert statement, but here is an example of both from an old test prog...

Option Explicit

Dim S As String

Private Sub Form_Load()

Dim adoCn00 As ADODB.Connection
Dim adoCm00 As ADODB.Command
Dim adoRs00 As ADODB.Recordset

Set adoCn00 = New ADODB.Connection
adoCn00.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\z\temp.mdb;User Id=admin;Password=;"

S = "INSERT INTO tblTest(vText) VALUES('Test Line 1')"
adoCn00.Execute S

Set adoCm00 = New ADODB.Command
adoCm00.ActiveConnection = adoCn00

S = "INSERT INTO tblTest(vText) VALUES('Test Line 2')"
adoCm00.CommandText = S
adoCm00.Execute S

End Sub

Good Luck

vb5prgrmr 143 Posting Virtuoso

Everything looks good except for line 4, you should use a command object there and not a recordset object, beyond that, the only thing I can say anything about is you indenting of the code in that section needs to be cleaned up a little...

Good Luck

vb5prgrmr 143 Posting Virtuoso

The reason it is giving you that error is because I did not complete the if elseif end if structure as it was only to be an example for you to do your own codeing.... not only to complete the structure for the remaiing weights but also the else and end if...


Good Luck

vb5prgrmr 143 Posting Virtuoso

Check out the Round function and the Format function and for how vb rounds, see some of the articles this search brought up...

http://search.yahoo.com/search;_ylt=AsacIZvoNaeCzNBceyH577ObvZx4?p=how+does+vb6+round+numbers&toggle=1&cop=mss&ei=UTF-8&fr=yfp-t-701

Good Luck

vb5prgrmr 143 Posting Virtuoso

You will probably want to go with an if elseif structure...

If Weight <= 1 then
ElseIf Weight > 1 And Weight <=2 Then
'...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, you are saying you want to edit a field? You want to set some field in some table = to some value?

strSQL = "UPDATE tablename SET fieldname = " & somevalue

if string then ... '" & somevalue & "'"
if number, as show in code block
if date, as I have previously shown you...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, I'm guessing that weight calculations are based upon earth standard normal, which means that based upon a packages weight being sent to the moon you would multiply it by .6 to get its destination weight, which is what I believe to be your excercise. From there you can use the select statement or a series of if elseif's to test that destination weight to calcualte the price. Once that is done, then you will be able to display the results...

Good Luck

vb5prgrmr 143 Posting Virtuoso

By using the first of my friends (yahoo, google, ask, answers, bing) with a search of "vb6 rotate image" I found 2 decent links and one great link over to vbaccelerator... Which by the way uses GDI+ and a search of "vb6 GDI+" will result in a whole lot of useful information and even some specific information if you add the word tutorial...

Give it a try

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, first, if I remember correctly, you want to check to see if a record exists in your database before you do your insert right?... so that means you need to do a select statement first...

pseudo code
strSQL = "SELECT * FROM tablename WHERE fieldname = " & somecriteria
rs.open...

Now at this point, I have to say I'm sorry as I this vital piece of information... This check

If Rs.EOF = True AND Rs.BOF = True Then

is wrong as a recordset cannont be both EOF and BOF so this will always return false... it should be as I noted on pg3 post #23 (and below)...

Okay, so where was I... Oh yeah...

psuedo code
strSQL = "SELECT * FROM tablename WHERE fieldname = " & somecriteria
rs.Open strSQL, ...

If Rs.RecordCount <> 0 And Rs.BOF = False And Rs.EOF = False Then
  'record exists so notify user
  msgbox "record exists"
Else
  'no record exists so insert information
  sql = "INSERT INTO merchandise_table(mch_no, mch_name, mch_umsr, mch_qtyh, mch_uprice) VALUES('" & txtmchno.Text & "','" & txtname.text & "','" & txtumsr.text & "','" & txtqtyh.Text "','" & txtuprice.text & "')"
  commandobject.execute sql
  MsgBox "Record added"
End If

NOTE: Insert statement does not need/use a where statement.
ALSO: I wrapped each value in the values section in the above with single ticks as you had some of the fields either starting with a single tick or ending with a single tick, …

vb5prgrmr 143 Posting Virtuoso

Correct, it is best to use the insert into statement when you can over the .addnew method, so don't use both to insert a record, one or the other...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Trim(Text1(0).Text) is the index of a textbox array...

.addnew = add new record
no .addnew = edit current record

Good Luck

vb5prgrmr 143 Posting Virtuoso

I don't have your code handy at the moment but lets say you have three text boxes that contain a number, text, and date and they are also an array of text boxes...

strSQL = "INSERT INTO tablename(numericfieldname, textfieldname, datefieldname) VALUES(" & Trim(Text1(0).Text) & ", '" & Trim(Replace(Text1(1).Text, "'", "''")), & ", #" & Text1(2).Text & "#)"

Now, as you can see, the first field that is a numeric field is not surrounded by single ticks (') while the text field is. Also, you can see the replace function that replaces single ticks contained within the text to be inserted with two single ticks ('>''). Now, what this does is it takes a word like don't and transforms it into don''t, but when it is inserted into the database, the database recognizes this as the word is supposed to have a single tick in it. So the database takes don''t and transforms it back into don't so when you pull the value back out of the database, you get what you want don't. Then as you see the third field is wrapped by pound symbols (#), which indicate to access (and access only) that a date is being passed to be inserted (Note: other databases will accept a string value and convert it to a date for you but access will not accept a value wrapped by single ticks and as such must be wrapped by the pound symbol).

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, around line 69 above, you would build your insert string and use either your command or connection object to execute the insert statement. So what you do is this...

strSQL = "INSERT INTO tablename(list fields here seperated by commas) values(now in the same order as the field list and seperated by commas you list the values you want to insert for each file and as noted above wrap strings with the single ticks number are not wrapped by those single ticks and date are wrapped by pound signs)
adoCn00.Execute strSQL

Now that is the best way to do an insert...

However you can do the rs.addnew/rs.field("fieldname").value = text1.text/rs.update starting at the same line number but this takes longer and can cause problems with multiuser systems depending upon the cursor type...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, there are three different insert into statements. One of them will create a new table from and existing table, another will insert records from another table into an existing table, and the third will simply put information into a table, I believe this is the one you want. The other two you can create through the access designer...

strSQL = "INSERT INTO tablename(stringfieldname, numericfieldname, datefieldname) VALUES('" & stringvariable & "', " & numericvariable & ", #" & datevariable & "#)"

Note: in the future, you will find that access is the only database that requires the date to be surrounded by the pound symbol (#).

Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes we may be able to help you but without knowing what the code is, the err.number and err.description,... well presently we are clueless as how to help you....

Good Luck

vb5prgrmr 143 Posting Virtuoso

Not sure if you can delete it... Post that or search first in the daniweb community feedback forum and if you don't find an answer, then post in that forum...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Time to use your friends (yahoo, google, ask, answers, bing) and search for vb6 mask color, as I believe you will need to make the second graphic only show the information. Or you mignt want to search on vb6 transparent picture box if that effect does not accomplish what you want. Then again, you could search on vb6 bitblt API or in help the paintpicture function and click on see also to select rasterop constants...

Good Luck

vb5prgrmr 143 Posting Virtuoso

You need an inner join statement in your from clause... The easiest way to get this correct is to use Access's query design window...

So go to the query tab/window of access and double click on create query in design view. Add the two tables when the window pops up. Now, from here you can either select all the fields or just that * symbol. From here you can check the result by selecting datasheet view, but the view you are after is the SQL view.

What you should see is something like this (but it may have more parens)

SELECT student.*, marks.* FROM student INNER JOIN marks on student.roll=marks.roll

Now copy this from access to vb and you are done! And just so you know, access's query design tools are great to design some of your more complex queries and as you can tell, it allows you to see instantly if you are getting the results you are expecting.

Also, another note. When it comes to the field that your tables are joined on, you will need to prefix the field with the table name...

txtRoll.Text = Rs.Fields("student.Roll").Value

Good Luck

vb5prgrmr 143 Posting Virtuoso

You are using VBA and NOT VB6.0. VBA is an interpreted language while VB6.0 can be compiled to native binaries (exe's, dll's, ocx's, etc.). So yeah, looking in Visual Basic 6.0 forums, your going to find a whole lot of functionality that VBA does not support... at least right off on a lot of it and it is very understandable why some people get confused between the two because they do share the same basic code base.

So, in the future you might want to look for VBA specific coding forums or Office forums for some things, but because the languages are so similar, usually you can get your answers from VB6.0 forums.

Now, to your specific problems...

A VBA form does not expose a hwnd as it is an interpreted and hosted form but you can add certain controls that do have a hwnd, but also because it does not expose a hwnd, it does not expose a windowstate and thus an icon in the appbar. The menu editor, is specific to to VB6.0 but that does not mean you cannot create your own menu with some tricks.


Good Luck