vb5prgrmr 143 Posting Virtuoso

Do you keep your connection to the database open for long periods of time? Unfortunatly, ado has the tendency to drop connections that are held open for long periods of time and if it is really ado's fault or the network or the server itself who knows. It is just a behavior I have noticed. The cure to this is to close all connections when not in use and reopen them when needed.

Good Luck

vb5prgrmr 143 Posting Virtuoso

You really need to read or remind yourself of what has been written in these threads. The query by mano can return more than one record and in that query mano use the alias key word AS [this name], my post was instead of qualifying the alias with the [] brackets you just use a single descriptive word, thesum.

Yes, if you use recordset navigation it will only show one record at a time but it was ment as an suggestion to show the results of mano's query which does show totals...

vb5prgrmr 143 Posting Virtuoso

Are you asking how to create controls at runtime to allow your users to view all of the returned results?

Set textboxes indexes to zero (0) and do something like...

Dim TextBoxCounter As Integer

Rs.MoveFirst
Text1(0).Text = Rs.Fields("Category")
Text2(0).Text = Rs.Fields("TheSum") 'instead of above AS [Total of Category]

Rs.MoveNext

TextBoxCounter = 1
Do While Not Rs.EOF
  Load Text1(TextBoxCounter)
  Text1(TextBoxCounter).Left = Text1(0).Left
  Text1(TextBoxCounter).Top = Text1(TextBoxCounter - 1).Top + Text1(0).Height + 30
  Text1(TextBoxCounter).Text = Rs.Fields("Category")
  Text1(TextBoxCounter).VisIble = True
  
  Load Text2(TextBoxCounter)
  Text2(TextBoxCounter).Left = Text2(0).Left
  Text2(TextBoxCounter).Top = Text2(TextBoxCounter - 1).Top + Text2(0).Height + 30
  Text2(TextBoxCounter).Text = Rs.Fields("TheSum")
  Text2(TextBoxCounter).VisIble = True
  
  TextBoxCounter = TextBoxCounter + 1
  Rs.MoveNext
Loop

or you could use recordset navigation buttons (movefirst, moveprevious, movenext, movelast) Or you could use a grid of some sorts to populate the data.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Yeah, I've seen this before and I have no idea why this happens but you can add this to the form load event.

Me.Width = Screen.ScaleWidth
Me.Height = Screen.ScaleHeight
Me.WindowState = vbMaximized

See if that helps...


Good Luck

vb5prgrmr 143 Posting Virtuoso

Check out the API's CreateFile (to get the handle to the file (read)), GetFileAttributesEx (to get the creation, accessed, and modified datetimes) or the GetFileTime API to do the same, and then finally FileTImeToSystemTime to convert the 64bit file time to system time format.


Good Luck

vb5prgrmr 143 Posting Virtuoso

check to make sure that you did not accidently change the windowstate property in the properties window. THen if you really want to make sure, add...

Me.WindowState = vbMaximized

to the forms load event.

Good Luck

vb5prgrmr 143 Posting Virtuoso

When you declare/pass an arguement to any sub/function you need to declare the type (as string, integer, recordset)

From what I am looking at it seems that you are trying to pass the recordset object named suppliers... i.e.

Dim Suppliers As ADODB.Recordset
'....

Public Sub MySub(ByRef MyArg As Suppliers) '<this will error as there is no global/public object defined as suppliers, error should be user defined type not defined.

At least that is what it looks like to me that you are doing.

As for using a class to set the properties of objects on a form you just may want to skip it. A class (at least from the way it looks like you are using it) is for holding data. What you may want to do is to create a sub withing the form and just pass the recordset object to it to set the text of your text boxes.

Now, if I have this wrong, when then... nevermind (in meek voice)


Good Luck

vb5prgrmr 143 Posting Virtuoso

Problem with the logic you are trying to implement...

You do not have a delimeter to tell the difference between characters so if I entered 252423... do you see...

You need to have a delimeter like a comma 0,1,2,3,4 or 25,24,23 or a space or dash or something because any type of loop that iterates from the first character to the last character will always give you the representations of 0 through 9. Or you can just have the user enter one character at a time and then output what they enter into another textbox.

So, if you use a delimeter then you will need to look at...

Arrays (Dim MyStringArray() As String)
Split Function (MyStringArray = Split(Text1.Text, ",")
UBound
LBound
For Loop
Concatination (Text2.Text = Text2.Text & ...)


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, I think you are over thinking this...

Now, if I understand you correctly you want the numbers (0 to 25) to represent A to Z. So when the user enters any number from 0 to 25, clicks the button, you show the letter from A to Z.

Private Sub Command1_Click()
If IsNumeric(Text1.Text) = False Then
  MsgBox "You must enter a number from 0 to 25.", vbOkOnly + vbInformation, "Incorrect Input"
  Exit Sub
End If
If CInt(Text1.Text) >= 0 And CInt(Text1.Text) <= 25 Then
  MsgBox "The letter is " & CypherArray(CInt(Text1.Text)), vbOkOnly, "Good Input"
Else
  MsgBox "You must enter a number from 0 to 25.", vbOkOnly + vbInformation, "Incorrect Input"
End If
Exit Sub

Where

Option Explicit

Dim CypherArray(0 To 25) As String

Private Sub Form_Load()

CypherArray(0) = "A"
CypherArray(1) = "B"
'...
End Sub

Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes,...

Do you know how to use the menu editor?

If so, then the command you need to know is PopupMenu.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the same methods as I have described and given examples of in your other threads that already solve this problem.

vb5prgrmr 143 Posting Virtuoso

Prime numbers converted to base 36, users name hashed by MD5 or other hash algorithm, any way you want. Search the web, this has been covered may times before and there are many snippets out there.

Good Luck

vb5prgrmr 143 Posting Virtuoso

No idea why? Ask over at http://www.dbforums.com/ in their sql forum or here http://www.tek-tips.com/threadminder.cfm?pid=183 (as I know there are more than several members that are on that board and that sites VB board.)


Good Luck

vb5prgrmr 143 Posting Virtuoso

If ID is a numeric field then...

conn.Execute "Insert into Class_Nursery (ID) values (" & Student_ID & ")"

Good Luck

vb5prgrmr 143 Posting Virtuoso

Single ticks (Mary's little lamb)...

Dim S As String, strSQL As String
S = "Mary's little lamb"
strSQL = "INSERT INTO Table1 (Field1) VALUES (" & Replace(S, "'", "''") & ")"
'...

Quotes should be the same but it is hard to tell without actual values.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Now without the report designer application and then that would not be through vb.


Good Luck

vb5prgrmr 143 Posting Virtuoso

or if it is a partial product id no then...

"Select * from table where productid like '" & sometext & "*'"

if it is text or if not remove the single ticks (')


Good Luck

vb5prgrmr 143 Posting Virtuoso

does not matter, debug.pring statements are ignored by the compiler so this is not your problem.

Keep Looking


Good Luck

vb5prgrmr 143 Posting Virtuoso

Are you sure you are using Visual Basic 6.0 and not VB.NET or VBA (access, word, excel,etc)?

vb5prgrmr 143 Posting Virtuoso

Tools>Options>Editor Tab>Put check next to require variable declaration>click ok.

Just like if you...
Dim I As Integer
In a lot of subs for looping but then make the mistake of doing

Dim i As Integer
Someplace, they all change to the lower case

Glad you have posted this thread as solved which I hope means you have this figured out.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Server name is the name the of the computer that the service is running, in this case the service is sql server and you need to enter the computer name.

Good Luck

vb5prgrmr 143 Posting Virtuoso

You are both forgetting to define which fields data is being inserted to...

Hence....

INSERT INTO TableName (FieldName) VALUES (ValueToBeInserted)

vb5prgrmr 143 Posting Virtuoso

Sir/ma'am, I will not do your work for you. You can hire me but I will not do your work for you for free.

Insert Into sometable (field) values (valuetobeinserted)


Please use the help system of access or sql. Use web searches or whatever, but most of all use your mind sir/ma'am.


Good Luck

vb5prgrmr 143 Posting Virtuoso

First create the new table from one of the other tables...

SELECT Table1.Field1, Table1.Field2, Table1.Field3 INTO tmpTbl FROM Table1

Then insert the records from the second table

INSERT INTO tmpTbl (Field1, Field2, Field3) SELECT Table2.Field1, Table2.Field2, Table2.Field3 FROM Table2

Now, select the records from the table

SELECT * FROM tmpTable

When done with table

DROP TABLE tmpTbl


Good Luck

vb5prgrmr 143 Posting Virtuoso

Once again insert into (field) value (thevaluetobeinserted)


Good Luck

vb5prgrmr 143 Posting Virtuoso

use the dateadd function


Good Luck

vb5prgrmr 143 Posting Virtuoso

Any way you want to...

prime numbers
base 36
some sort of encryption


Good Luck

vb5prgrmr 143 Posting Virtuoso

You will need to seperate the printer setup from the actual printing...

printer setup stuff
do while rs.eof = false
  printer.currentx = value
  printer.currenty = value
  printer.print
loop
printer.enddoc

Good Luck

vb5prgrmr 143 Posting Virtuoso

alarm_type = v & Mid$


Good Luck

vb5prgrmr 143 Posting Virtuoso

Dim MyValue As Double 'for decimal places else integer if inventory not to execeed 32k+ or then long

MyValue = MyValue + Quantity '5 + -5 = 0 5 + 5 = 10

Update Table Set field = MyValue

Or you can just keep a recordset in memory and then refresh it once you do an update statment which would be...

rs.refresh

Good Luck

vb5prgrmr 143 Posting Virtuoso

Use INSERT INTO statement (search site, your threads), so...

Create Table by using insert into from first table
Then use insert into from second table
Then select * from temp table
Then your option
delete records to reuse table later
or
delete table (drop statement)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Create temp table with insert into from one table, use insert into from other table, then select records from temp table. When done, delete temp table if you want or keep it around and reuse it in future.


Good Luck

vb5prgrmr 143 Posting Virtuoso

WHERE staff_badgeTracking.Badge_ID = 1234

Good Luck

vb5prgrmr 143 Posting Virtuoso

you mean it will possible with check box not with option button.

Yes

vb5prgrmr 143 Posting Virtuoso
"WHERE ALRAJHIBANK.ID = " & itemID

Good Luck

vb5prgrmr 143 Posting Virtuoso

Option buttons = either one or the other NOT both. CheckBoxes = one, both, none.


Use the right control for the right application.

Good Luck

vb5prgrmr 143 Posting Virtuoso

SendKeys generates the error because MS in it infinite wisdom missed it/did not want to support it/thought it could be used maliciously/who freaken knows.

To get around it UAC needs to be disabled. May still generate an error in IDE but not with exe. RunAs Admin and several other ways.

Best to replace sendkeys with the SendInput API.

And to be honest, I never really liked sendkeys because the application had to have focus and some of the thing I program have to work in the background.


Good Luck

vb5prgrmr 143 Posting Virtuoso

One would think that those newer DB have an upgrade wizard of some sorts (MS Likes Wizards), and one would think also that you could detach your database from 2k and then attach it to 2k5 or 2k8.


Good Luck

vb5prgrmr 143 Posting Virtuoso

once again...

SQL = "INSERT INTO TableName(Field1Name, Field2Name, ...) VALUES(" & val(text1.text) & ",'" & text2.text & "')"

Where TableName is the name of your table
Where Field*Name is the name of the field you are going to add data to
Where val(text1.text) is adding a numeric value to Field1Name
Where '" & text2.text & "')" denotes adding text to Field2Name


Good Luck

vb5prgrmr 143 Posting Virtuoso

Unfortunatly no. There are three layers to forms and containers. The back layer is where the forms graphical methods are drawn. The next layer layer is where graphical controls are rendered and this is where the image control lies(controls with no hwnd). The top layer is where windowed controls are rendered (anything with a hwnd).

So, you can use a picturebox if you want to coverup other controls.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Hi Fauzan

The short answer is "you can't" as SQL only handles text, not images.

You can however create a table in SQL where you put the links to all the image files. Then in your report you can link the data that you want with that text link. You then take that text output from SQL, and through the formatting of your report you can use that retrieved link to load the picture.

You really should follow up with that the long answer is that you can but this is the preferred method by many, that is just to store the path to the file in the database and not the file itself. And just for you information there are a couple of ways to do it.

OP. Use the Data Form Wizard, which you will find under Add-Ins>Add-In Manager and use the ODBC option which means before you use it you will have to create an ODBC DSN. Use each form option in combination with code/class/control and save project for future use. Then once you are ready to go to a DNS Less connection see http://www.connectionstrings.com


Good Luck

vb5prgrmr 143 Posting Virtuoso

You may also have to prefix badge id with one of the two table names since you have an inner join on badge id.


Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

What you can do is create a temporary table by inserting into (you've seen this before) and then retrieving your records from that. Then delete the table or just keep it around and when you are done delete the records from it. Now, since you are using SQL 7.0 you could create a stored proceedure to accomplish this by using a memory table (a table created in memory, filled with information, and passed back to your application) however, I would suggest that you use http://www.dbforums.com for them to help you get the correct syntax you will need.


Good Luck

vb5prgrmr 143 Posting Virtuoso

And what does sendkeys have to do with explanations of a listbox's properties/methods/events?

Add list box to form, make sure it is selected, press F1, and read all about it.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the additem method put a few items into a listbox. Press CTRL+BREAK and use the immediate window to find your answers.

?List1.List(1)
?List1.ItemData(1)
List1.Selected(1) = True
?List1.ListIndex

Now, you will notice that list and itemdata return different string because one is zero based and the other is one based.


Good Luck

vb5prgrmr 143 Posting Virtuoso

and your question is???

vb5prgrmr 143 Posting Virtuoso

Create an ODBC DSN and test it to make sure it works.
Then use the Data Form Wizard with the ODBC option. You will find it under Add-Ins>Add-In Manager.
Run this wizard as many times as needed to create every combination of form type with code/class/control. Then save this project for future reference.

Then when you are ready to goto a DSN Less connection goto http://www.connectionstrings.com


Good Luck

vb5prgrmr 143 Posting Virtuoso

Click event of the option buttons


Good Luck

vb5prgrmr 143 Posting Virtuoso

Well, I don't see where you are opening the recordset rs but I do see rstrack being opened. Is that the recordset object you want to assign to your grid???


Good Luck