vb5prgrmr 143 Posting Virtuoso

class is the name of the field, at least that is what you showed above. If your field name is different then use that name...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Several ways....

Dim F As Form, M As MDIForm
For Each F In Forms
  If F Is M Then
  Else
    Unload F
  End If
Next
Dim F As Form, M As MDIForm
For Each F In Forms
  If F.Name = "MDIForm1" Then
  Else
    Unload F
  End If
Next

and I could probably think of a few more but either one should do ya!


Good Luck

vb5prgrmr 143 Posting Virtuoso

They are constants defined to tell the dll that you call what to do.

As for red/black you need to search on using a mask color transparency vb6.

Good Luck

vb5prgrmr 143 Posting Virtuoso

SELECT MAX(roll) AS THEMAX FROM TableName WHERE class = 'nine'


Good Luck

vb5prgrmr 143 Posting Virtuoso

Start a new standard exe project>vb's ide menu>Add-Ins>Add-In Manager.
Hightlight VB 6 Data Form Wizard
Lower right corner of form where frame with caption says Load Behavior put a check in the box next to Loaded/Unloaded>click Ok

Add-Ins>Data Form Wizard
Follow wizard enough times to get every combination of form type along with code/class/control.
Save project for future reference.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, lets say we have this table...

Table1
iID (autonumber unique ID)
iValue (Number Long)

and data has been entered like so...
iID iValue
1 4
2 8
3 1
4 3
5 9
6 2

Now to get the LAST record entered we would use...

SELECT TOP 1 iValue FROM Table1 ORDER BY iID DESC

To get the greatest number entered into the iValue field we would use

SELECT MAX(iValue) AS TheMax FROM Table1

and reference it via the alias TheMax (Rs.Fields("TheMax")


Good Luck

vb5prgrmr 143 Posting Virtuoso

Well the between operator is for use on one field so...

SELECT * FROM Table1 WHERE (Date1 AND Date1 BETWEEN DTP1.Value AND DTP2.Value) AND (Date2 AND Date2 BETWEEN DTP1.Value AND DTP2.Value)

As for three dates...

SELECT * FROM Table1 WHERE DATE1 = Value1 OR Date1 = Value2 OR Date1 = Value3


Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

Okay, you will need to delve into the world of the API to accomplish what you want to do. You can start with FindWindow or FindWindowEx to get the hwnd of another application. Then to read text from a window you will need to use SendMessage with the const WM_GETTEXT but you will need a handle to that specific window (each control on a form is a window) so you will need to use EnumChildWindows to enumerate through the controls on the other applications form. As for clicking on the other applications buttons you will once again need the handles to those windows via EnumChildWindows and then use SendMessage once again with a WM_MBUTTONDOWN followed by a WM_MBUTTONUP message.

As for the anoying message, use the query_unload event of your form to test for how the program is being shut down because when the OS is shutting down you may not want to nag the user.


Good Luck

vb5prgrmr 143 Posting Virtuoso

johnly,

>For example call this in the Page_load event.

Ahh, that would be Form_Load in VB 6.0


and brieghz23, the style show in your graphic is a style of 1


Good Luck

vb5prgrmr 143 Posting Virtuoso

Only problem with that johnly is using the change event of the textbox. As the lookup code (number/alpha) gets longer your code will be executed each time there is a change! Which means for a four digit code, your code will pound the datbase four times with your look up query! Better to put the actual search under a command button (or perhaps the lost focus event of the text box if you want a high amount of automation).

sackymatt,

Have you even tried the Data Form Wizard and see what code it generates for you?


Good Luck

vb5prgrmr 143 Posting Virtuoso

For examples on how to do various things use the Data Form Wizard. You will find this under Add-Ins>Add-In Manager. Search my handle and data form wizard for the full suggestion.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay siu17,

Please take the following as constructive comments from someone who has been a team leader and an integrator.

Even though there is a default property for a lot of things like your text boxes, you should not rely upon them but explicitly use the dot syntax to show exactly which property you are modifying...

Do not do this...

Text1 = ""

But do this instead...

Text1.Text = ""

Or better yet...

Text1.Text = vbNullString

Then when it comes to accessing your recordset/fields you should do something like this...

Text1.Text = Rs.Fields("FieldName").Value

These just make it easier to actually read the code when it comes time to perform maintenence upon it.

Now, I also see that you declared a variable between two subs...

End Sub
[B]Dim searchvar As Integer[/B]
Private Sub Command1_Click()

Now that declaration shoud be at the top in the "general declarations" section of the form (just under Option Explicit).

Now lets hope I can answer your question...

This...

rec1.Open ("select * from table where 'Key = searchvar'"), conn, adOpenStatic, adLockReadOnly

is where your problem is...

Since searchvar is declared as an integer, you do not need the single ticks as you are stating that you are not searching for a string (and you have the single ticks in the wrong place.).

It should be something like...

rec1.Open "select * from table where Key = " & searchvar, …
vb5prgrmr 143 Posting Virtuoso

Actually to calculate this, even the hard way, you don't need a timer you just need a for loop and a couple of variables to see the results after X number of iterations.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Then that means you have two records with the same value that you are displaying.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes, this is all about API...

The Private/Public Declare Function/Sub is the give away.

Now what this code does is it alters the forms opacity level, which means the higher the alpha value the more opaque or less transparent the form is.

As for learning API there are many sites out there like this one...

http://allapi.mentalis.org/


Good Luck

vb5prgrmr 143 Posting Virtuoso

Check the settings of your server and OS and I think you need to specify the port of 1433...

see...

http://www.connectionstrings.com/sql-server#6

then scroll down a bit for internet connection


Good Luck

vb5prgrmr 143 Posting Virtuoso

You need the VB.NET forum...

http://www.daniweb.com/forums/forum58.html

vb5prgrmr 143 Posting Virtuoso

Couple of ways. Are you using an ODBC DSN or are you going DSN Less?

DSN Less see http://www.connectionstrings.com


Good Luck

vb5prgrmr 143 Posting Virtuoso

See my post in your other thread...


Good Luck

vb5prgrmr 143 Posting Virtuoso

You need to use the .AddItem method to add items to the combo box.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Thesis...

Hardware versus software and the inability of hardware speed to keep up with the complexity of higher level languages in the attempt to package multi use objects for the layman to drag and drop these objects to create a process or a workflow system.


Specifically I am talking about the way .NET and the OO revolution ceases to take advantage of processor speed and coupled with the diverging paths of 32 bit and 64 bit architectures that have seemed to put a hold on the 18 month cycle of processor speed increments.


Good Luck

vb5prgrmr 143 Posting Virtuoso

For MD5 there are a couple of ways...

See strongm's post about 1/4 of the way down in this thread...

http://www.tek-tips.com/viewthread.cfm?qid=535644

or there is a post at http://www.pscode.com that is a module that calculates the MD5 hash. (Strongm's is faster).


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, user types in a badge ID that they have in hand, and then hit a search button or a search is done and the data grid is populated with a bunch of information.

Now depending upon if the user is handing the badge to the employee for the employee to use or taking it back you have to either a) make an entry into table1 to note that the badge is in use or b) make an entry into table2 to note that the badge is no longer in use.

So you are going to need an if statement that test to see if information is going into table1 or table2.

Now, if I have understood you correctly so far... If the information is going into table1. Then you will need to insert that information via an insert statement into table1 or if the information is going into table2, then you will also need an insert statement but the values of this insert statement will be coming from table1. After that, then you will need to delete the information from table1.

Okay, so if I have this right then...

If condition means insert into table1 then
INSERT INTO Table1(Field1, Field2, Field3,...) VALUES (Value1, Value2, Value3,...)
Else
INSERT INTO Table2(Field1, Field2, Field3,...) VALUES (Value1 from table1, Value2 from table1, Value3 from table1,...) WHERE Table1.Field = unique criteria
'execute query
DELETE FROM Table1 WHERE Field = unique criteria '(same unique criteria …

vb5prgrmr 143 Posting Virtuoso

Yes, you will need an if statement.

The code I gave you is for creating a new table from an old table, as in all the records from table1 will be inserted into table2 of which table2 is created. The result is that you will have two tables with the same information. And once again. I ask why?


Good Luck

vb5prgrmr 143 Posting Virtuoso

Several ways in which to do this and it all depends upon how your database is designed and the code you have. It could be something as simple as rs.delete or strSQL = "DELETE FROM Table1 WHERE FieldCriteria = " & SomeCondition


Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes it is possible, and with way too many ways in which to describe in just a single post. So lets break your question down into simple strait forward tasks.

First, you have badge ID's. How do you display them? ComboBox, Grid of some sorts, or is user supposed to know these badge ID's from memory?

Second, you have employees. How do you access them? Display Them?

Need help with code? Start with data form wizard.


Good Luck

vb5prgrmr 143 Posting Virtuoso
strSQL = "SELECT SUM(FieldAmount) AS TheSum FROM MyTable WHERE FieldCriteria = " & SomeCondition

Good Luck

vb5prgrmr 143 Posting Virtuoso

Normally used in classes, for setting retrieving property/variable in class. Think also activex, user controls, objects, and such.

From VB's help...

Set
Declares the name,arguments, and code that form the body of a Propertyprocedure, which sets a reference to an object.

Let
Declares the name,arguments, and code that form the body of a Property Letprocedure, which assigns a value to aproperty.

Get
Declares the name,arguments, and code that form the body of a Propertyprocedure, which gets the value of a property.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, I just refreshed my memory on the Data Form Wizard and refreshed my memory on what you said...

>( as all my textboxes are named "textfields")

Which means your textboxes are an array and to double check I used the wizard to make sure that it creates an array of textboxes. SO YES you have an array of text boxes as they are all named "textFields"!

So to pass the combo's text to one of the text box controls you will need to use it's index!

Text1(Index).Text = Combo1.Text


Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

>all this code is for vb6. and the DAODC AKA Data1

Use the data form wizard, of which you will find under add-ins>add-in manager. Start a new standard exe project and then run the wizard as many times as necessary so that you have selected each form type and use each class/code/control. Save this as an example project and modify form1 to startup the other forms and that way you can walk through the code of each form type with F8.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, you have an array so it would be...

Text1(Index).Text = Combo1.Text

Good Luck

vb5prgrmr 143 Posting Virtuoso

have you looked into the graph control?


Good Luck

vb5prgrmr 143 Posting Virtuoso

as an example...

strSQL = "SELECT Table2.iID, Table2.iNum INTO Table3 FROM Table2"

Good Luck

vb5prgrmr 143 Posting Virtuoso

1st, if you need to, install the MySQL drivers on the other machine.
2nd, create the ODBC DSN on the other machine to point to your instance of MySQL.
3rd, create an install package with the PDW or Inno and instal program on other computer.

Or to answer your question more directly...

No you cannot have a program on another computer access your ODBC DSN. It needs to be created on the other computer.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the click event of the combo and set the text of the text box to the text of the combo box...

Text1.Text = Combo1.Text

Good Luck

vb5prgrmr 143 Posting Virtuoso

And why can you not keep the attendance records in the same table?

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

Okay, start a new standard exe project.
Add reference to DAO 2.5/3.51
Declare a tabledef variable

Dim T As DAO.TableDef

Highlight TableDef and press F1
Click Example and choose the second one down.


Good Luck

vb5prgrmr 143 Posting Virtuoso

No, you got it right...

tblAddress
iAddID
vStNo
vStName
vCity
vSt
vZip

1, 123, Street A, SomeCity, SomeState, 12345
2, 234, Street B, SomeCity, SomeState, 23456

tblName
iNameID
iAddID
vFName
vLName

1, 1, Jane, Doe
2, 1, John, Doe
3, 1, John, Doe Jr.

In this example the Doe's all live at the first address hence the one to many relationship identified by the foreign key


Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the data form wizard. Search my handle and those keywords to learn how to invoke it, use it, and what to do with it.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the Rnd function (see VB's help), with randomize. Use an array to hold the values, and use a sorting routine or just a simple For Loop structure to make sure a duplicate number is not generated.


Good Luck

vb5prgrmr 143 Posting Virtuoso

nikhil2911,

Perhaps I should not suggest this, but there are many calculator projects out there. See http://www.pscode.com for some or search the web vb6 calculator.

Now, the reason I have doubts for suggesting the above is, I don't want you to plagiarize someone elses work, but if you look and learn from there code to create your own, well that is why you are taking the class right!


Good Luck

vb5prgrmr 143 Posting Virtuoso
Unload Form1
Unload Form2

Every form?

Dim F As Form
For Each F In Forms
  Unload F
Next F

Good Luck

vb5prgrmr 143 Posting Virtuoso

Why are you worried about the numlock key? You shouldn't need to be worried about the numlock key, at least not in this application.


Good Luck

vb5prgrmr 143 Posting Virtuoso

First question is... If you are creating an employee database, why do you want to create duplicate tables and duplicate records? Then, when an employee employment ends, why do you want to delete the employees records? These records could have important tax information.

Perhaps a bit better explanation/plan of what you want to do and why might help us to help you better.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Flesky,

Please, in the future, start your own thread and if you need to reference an older thread copy its URL into your post.

Now, when you start your new thread, please mention if you are using VBA (Excel, Access, Word, etc), VBS, or VB 6.0.

Thanks and Good Luck

vb5prgrmr 143 Posting Virtuoso

Actually cguan_77 you are not far off...

Private Sub btPrint_Click() 

On Error GoTo btPrint_ClickError

Dim frm As IspecialForm 
Set frm = Me.ActiveForm 
frm.GetTextBoxInvisible 
frm.Refresh 
'CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums 
CommonDialog1.Action = 5 
CommonDialog1.PrinterDefault = True 
CommonDialog1.CancelError = True 
CommonDialog1.Orientation = cdlPortrait 
CommonDialog1.ShowPrinter 
frm.PrintForm 
Printer.EndDoc 
frm.SetStartDesign 

Exit Sub
btPrint_ClickError:

If Err.Number = 32755 Then Exit Sub 'User Pressed Cancel

MsgBox "btPrint_Click " & Err.Number & ":" & Err.Description

End Sub

The reason it is still printing is because you had no error handler.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, the reason you are getting the results you are getting is because there is no unique identifier that relates the two tables together and you have no selection criteria.

Table1
iNameID AutoNumber
vName (BTW NAME is a keyword that can cause confusion)
iRoll Number

Table2
iClassID AutoNumber
iNameID Number Foreign Key
vClass (BTW Class VBA Keyword)
dDate (BTW Date KeyWord)


Good Luck