vb5prgrmr 143 Posting Virtuoso

Just noticed something, you have typed the word "from" and not "form". Did you happen to misspell this?

Second, in design view, are you sure that the form you want to open is named form2?

Third, try...

If Form1.WindowState = vbMaximized Then
  Load Form2
  Form2.WindowState = vbNormal
  Form2.Visible = True
End If

Good Luck

vb5prgrmr 143 Posting Virtuoso

There are several ways in which to add data to an array...

Dim S As String, MyArray() As String
S = "test1,test2,test3,test4"
MyArray = Split(S, ",")
Dim MyArray() As Integer
ReDim MyArray(3) As Integer
MyArray(0) = 0
MyArray(1) = 12
MyArray(2) = 34
MyArray(3) = 43
Dim I As Integer, MyArray() As String

For I = 0 To 10
  ReDim Preserve MyArray(I) As String
  MyArray(I) = CStr(I)
Next I

So, from what I can see is that you are using a two dimensional array and you are also populating this information from a file or some source. I'm guessing it is a file as I don't quite remember what the read statement is for in qbasic.

The following is for a file in the following format...
Data1Line1,Data2Line1,Data3Line1,Data4Line1
Data1Line2,Data2Line2,Data3Line2,Data4Line2
'...
Data1Line5,...

Dim FName As String, FNumb As Integer
Dim LineContents As String, PiecesOfData() As String, ForLoopCounter As Integer
Dim CapturedData(0 To 4, 0 To 3) As String, LineCnt As Integer 'or 1 to 5, 1 to 4

FNumb = FreeFile
FName = "Path File Name"

Open FName For Input As #FNumb
Do While Not EOF(FNumb)
  Line Input #FNumb, LineContents
  PiecesOfData = Split(LineContents, ",")
  For ForLoopCounter = 0 to 3 'or 1 to 4
    CaptureData(LineCnt, ForLoopCounter) = PiecesOfData(ForLoopCounter)
  Next ForLoopCounter
Loop

Close #FNumb

Good Luck

vb5prgrmr 143 Posting Virtuoso

should it not be...

Adodc1.Recordset.fields("name") = txtname.text

Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

No, but if you search Nextag.com or ebay you should be able to find full versions for real cheap.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well reading the help file on this it says that for better performance that you should use a query with a where clause...

so...

strSQL = "SELECT * FROM SomeTable WHERE SomeField = somevalue
Set Rs = Db.OpenRecordset(strSQL,...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Look at the dateadd function....

Dim LastDayOfMonth As Integer
LastDayOfMonth = Day(DateAdd("d", -1, Month(Now) + 1 & "/1/" & Year(Now)))

Good Luck

PoisonedHeart commented: Thank you for your time and effort for solving my problem! :) +1
vb5prgrmr 143 Posting Virtuoso

Result = Left(String, Len(String) - 1)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well if that is where you saved them, you should find a single *.VBG and two or more *.VBP files plus other files like, *.FRM, *.FRX, *.BAS, *.CLS and so on.


BTW: I did not say remove, just double click on the proper *.VBP file

Good Luck

vb5prgrmr 143 Posting Virtuoso

Look at where you have saved your files. You should see a *.vpg, and one or more *.vbp files. the *.vpg is the group while the *.vbp are the project files. To access just the project, double click the *.vbp file.

Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

have you searched/looked at http://www.connectionstrings.com ?

Good Luck

vb5prgrmr 143 Posting Virtuoso

Without having to change any of your code you can still accomplish what you want. In the forms design view, highlight the button and then goto its properties. Find the "default" property and make it true.

This property tells the OS that this button is the default button to press when user hits enter key.

Good Luck

Vineeth K commented: Thanks for new Idea ........ +1
vb5prgrmr 143 Posting Virtuoso

If you are using an object, i.e. ADO and a Do While Loop you could do something like...

Dim Cnt As Integer
adoRs.MoveLast
Prog1.Max = adoRs.RecordCount
adoRs.MoveFirst
Do While Not adoRs.EOF
  'populate grid...
  Cnt = Cnt + 1
  Prog1.Value = Cnt
  adoRs.MoveNext
Loop

Good Luck

vb5prgrmr 143 Posting Virtuoso

A combination of the webbrowser control, DOM, and the URLDownloadToFile API will do this for you.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Use the application wizard that you can find under Add-ins

Good Luck

vb5prgrmr 143 Posting Virtuoso

Google, yahoo, bing, ask, answers,... are your friends as is http://www.planet-source-code.com plenty of examples out there.

Good Luck

vb5prgrmr 143 Posting Virtuoso

maskededit.text = format...


Good Luck

vb5prgrmr 143 Posting Virtuoso

You have two options...

use the...
.Left
.Top
.Width
.Height

Properties or you could use the...

.Move

Method

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, I normally use SQL Server Authentication but presently surrounded by machines with no SQL Server so this is from memory...

Start SQL manager (MMC?) (on the server). Connect to the instance that you eventually want to connect to. Connect to the database and if you right click??? I think you should be able to add a user there. Give them read/write/modify/etc. access.

Now, while you are there start query analizer (sp?) and use the login you just created and hopefully you should have your database listed in the combobox at the top...

Now, from XP machine where you are having trouble. First try to create an ODBC DSN (Admin tools? ODBC Data Source) to see if you can connect. I'm betting that you don't acutally have the correct driver on your system for the DSN Less connection you are trying to create, which means you will have in instal a MDAC from MS.

Okay, so you can connect, now rebuild your connection string from the info provided a connectionstrings.com, but be sure that you have the correct template for sql auth...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well, I know the format function formats it like you want...

MsgBox Format("4321", "00-00000000")

Good Luck

vb5prgrmr 143 Posting Virtuoso

use the format function on the input of the four numbers to format it the way you want to display.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well then go with the LBound/UBound to make sure you don't run out of bounds...

For ForLoopCounter = LBound(MyArray) To UBound(MyArray)
  '...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Not quite sure what you are trying to accomplish but...

MsgBox Join(MyArray, vbNewLine)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, through windows explorer, on the machine and under the account that the program runs, can you delete the file from there?

I'm wondering if it may be an accesibility rights issue.

Just for a quick test...

If Dir(PathFileName) <> "" then
  MsgBox "Found"
Else
  MsgBox PathFileName
End If

Good Luck

vb5prgrmr 143 Posting Virtuoso

Check the format property of the field or you could just change the field to long and store it as a number in the format of yyyymmdd since you are only storing the date portion. This causes you a little more problems as you have to format it going in and parse it coming out but quering against it is much faster than a date field. One other though is try passing it as a string ( '" & a & "'" ) (I think it used to work been so long...)


Good Luck

vb5prgrmr 143 Posting Virtuoso
If Dir(PathFileName) <> "" then Kill PathFileName

Good Luck

vb5prgrmr 143 Posting Virtuoso

You will need a variable to keep track of how many friends have been entered.

Dim MyFriendCount As Integer, LoopCounter As Integer

Then you will need to initialize your friend counter

MyFriendCount = -1

Then you will need to test to see if you haved entered any friends yet...

Dim FoundFriend As Boolean
If MyFriendCount = -1 Then 'no friend have been entered

But if they have then you need to test if you have reached the limit...

ElseIf MyFriendCount > 10 Then 'too many friends or you need to redimension array so notify user...

Then of course if you have not exceeded the friend count...

Else 'need to check to see if you have already entered friend
  For LoopCounter = 0 To MyFriendCount
    If UCase(Text1.Text) = UCase(Friends(LoopCount)) Then
      FoundFriend = True
    Else
      FoundFriend = False
    End If
  Next LoopCount
  
  If FoundFriend = True Then
    'notify user
  Else
    MyFriendCount = MyFriendCount + 1
    Friends(MyFriendCount) = Text1.Text
  End If
End If

Good Luck

vb5prgrmr 143 Posting Virtuoso

Check in the help files for the specs of the database. I'll bet you have gone over some sort of limit and i'm almost sure it is the 64k limit imposed on modules.


Good Luck

vb5prgrmr 143 Posting Virtuoso

So, you want the string to start off with a comma? Well then....

MyString = "," & MyString

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, first future reference. In VB's IDE, goto the menu>Tools>Options and put a check in the box next to where it says Require Variable Declaration.

Okay, now for your problem. You are checking Form1's windowstate and setting form2's. Is form2 even loaded? If not then the problem may be that you are trying to access the properties of a form that is not loaded.

But this does not make sense so I have to ask. Are you sure you are using VB6 and not .NET or VBA (Excel, access, word)?

SO, if you are sure that you are using VB6 then goto vb's menu>Progect>References and the first four items should be these in this order...

Visual Basic For Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
OLE Automation

Good Luck

vb5prgrmr 143 Posting Virtuoso

Hit CTRL+Break and see which/where code is highlighted. Do you have Option Explicit (Require Variable Declaration) turned on?

Good Luck

vb5prgrmr 143 Posting Virtuoso

What ever b8controls is but I have never heard of it before...


Good Luck

vb5prgrmr 143 Posting Virtuoso

Then see my post above, remove the single ticks from around the fields that are numbers and use Trim, val, cint etc. to make sure the values from the boxes are not preceeded or trailed by spaces.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Glad I could help, if you don't mind, could you please mark this thread as solved.


Thanks and Good Luck

vb5prgrmr 143 Posting Virtuoso

Well it looks like you have lost reference to a custom control. Did this project come from another computer? If so you need to instal/register the missing control/dll on this new computer.

If not, and you have the controls installed correctly on this computer then find the controls (which should now be picture boxes), delete them, and replace them on the forms.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Google and yahoo are your freinds as is www.pscode.com. There are many snippits out there that does this.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, in the click event of your command button that closes the form or in form_unload you need to close all your objects and set them to nothing...

Rs.Close
Set Rs = Nothing

and that goes for your command objects, parameter objects, recordsets, connections, and so on for everything that you have declared within this form.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Without seeing your code it is hard to guess what exactly is going on but from the sounds of it, you have not fully unloaded the form when you try and show it again.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, if strings you are missing the single ticks...

"UPDATE Class_Nursery SET Subj1 = [B]'[/B]" & txtSbj1.Text & "[B]'[/B] WHERE Status = 'Continue' AND Session = [B]'[/B]" & txtSession.Text & "[B]'[/B] AND Section = [B]'[/B]" & cmbSection.Txt & "[B]'[/B]"

As for updating multiple fields you have already posted the code...

SET Field1 = value1, Field2 = value2, ...

Good Luck

vb5prgrmr 143 Posting Virtuoso

You can't.

vb5prgrmr 143 Posting Virtuoso

Update.... where somefield=somevalue

You are missing the where statement and as such are setting everyrow to same value.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Because you don't have them in upper case. You have them in Propercase (Four, Five, Six). If you want them in all caps then use the UCase function or change your code. Also, if you set a breakpoint in TxtPaymentInWords_KeyPress, you will find out that when you go TxtPaymentInWords.Text = "string", the keypress event is not called because no keypress event happened, you just changed the text of the textbox.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, to split on the comma (,) you need to use...

THE Split Function!

Dim MyArray() As String
MyArray = Split(lstData.List(i), ",")
txtID.Text = MyArray(0)
txtName.Text = MyArray(1)
txtAge.Text = MyArray(2)

Then would it not be lstData.RemoveItem(i)?

And now for why you are having so many problems...

Tools>Options>Put a check next to Require Variable Declaration>OK

In future projects this will put Option Explicit at the top of all your forms and modules and will make you declare your variables. This will solve a lot of problems for you. In fact, you could manually put it in at the top of your existing forms and modules and this will help you out by pointing out your mistakes.


Good Luck

vb5prgrmr 143 Posting Virtuoso

Google/yahoo are your friends...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Time to delve into the API...

FindWindow and SetParent should do the trick for you...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Either, if from vb use the command object to execute it.

As for crystal reports, yes you will need to install it. if you have pro or enterprise you should find on the disk a folder named crystal, inside is the installable. Run it and you will have crystal reports 4.5.


Good Luck

vb5prgrmr 143 Posting Virtuoso

UPDATE Table1 SET Field2=Table1.Field2-1 WHERE Field1=Value

Where Field1 = unique value to identify record and Field2 = the value you want to decrement by 1

As for creating an invoice there are several ways. Datareport, Crystal Report, or one of your own design via the Printer object. But to be able to do this you will need a purchase table to record the items purchased with some unique ID that ID's the customer so when you go to print the reciept, the table can be queried against.


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 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