abelingaw 69 Posting Whiz in Training

Set the timer interval to 5000 in the Properties window and put this code on a timer control.

If Timer1.Interval = 5000 Then 'Timer1 is the default name, change if necessary
Unload Me
End If
abelingaw 69 Posting Whiz in Training

I have created a page (with php and javascript) but i am having a problem.
Whenever i add contents or remove some, the footer comes up or the whole page re-sizes.

I would like the whole page to stay as the original length like the main page
regardless how much or how small the contents of a page is.

And about the div's, got the overflow on auto. Its just the page really.

abelingaw 69 Posting Whiz in Training
Raghu_Ganapm commented: Good answer +0
abelingaw 69 Posting Whiz in Training

Found a solution.. I tried using list.

echo "      <li><span><a href=\"INSERT URL HERE\">News</a></span>\n";
echo "	  <ul class=\"level-1\">\n";
echo "          <li><span><a href=\"INSERT URL HERE\">School Campus</a></span></li>\n"; 
echo "          <li><span><a href=\"INSERT URL HERE\">Activity for the Month</a></span></li>\n"; 
echo "          <li><span><a href=\"INSERT URL HERE\">Administration Updates</a></span>\n"; 
echo "        </ul>\n";

Tried the JQuery and got some new idea from it. Thanks . Thread Solved

abelingaw 69 Posting Whiz in Training

I was just wandering if someone could help me how to redo a case statement.

After executing the program, there would be a line asking :
Try Again? YES / NO

If yes, then the program re-executes without hitting F5 again. (using JCreator pro 5).


All i have is this:

System.out.print("Tray again? (1=Yes/0=No)? ");
        int Answer = scnr.nextInt();

        if (Answer == 1)
           //DON'T KNOW WHATS NEXT HERE
        else
            //DON'T KNOW WHATS NEXT HERE

Snippet would be greatly appreciated.

abelingaw 69 Posting Whiz in Training

Are those softwares sir? I would only like to use pure html or css.

abelingaw 69 Posting Whiz in Training

I just wanna know how to enable tab switching without the whole page reloading. When i click a tab, the page would appear on a form or lets say a part of a page (e.g <div>).

Dont want to use frame.

And i would like to know how to have a drop down from tabs, like the one from this site on the menus.

abelingaw 69 Posting Whiz in Training

Some links are no longer active.. Cheers!!

abelingaw 69 Posting Whiz in Training

Good to be back here.. :)

Got no issues about programming (ATM), but got some problem regarding my Network Adapter.

It's Atheros AR9285 Version 8.0.0.238. My problem is that, it does detects WiFi network connections but i cant connect to them even if its a public or open network, doesn't require passwords or anything.

I can't connect really. I tried updating the device but it says i have the latest.


My Computer model is MSI CR410
My windows spec is as follows:

  • Windows 7 Ultimate
  • Processor AMD Athlon Dual Core 2.3- GHz
  • RAM 2GB
  • 32 Bit

Thanks!!

abelingaw 69 Posting Whiz in Training

I replaced my original code (with yours) with this one:

Private Sub txtrate_LostFocus()

txtrate.Text = FormatNumber(txtrate.Text, 2)

End Sub
abelingaw 69 Posting Whiz in Training

Still don't work sir.

Design and Run time, but didn't work. It always counts the period as an element or text.

I've tried removing all my codes but its just plain numbers without decimal places.

It should limit the first 5 numbers as its max length then at lost focus, it will automatically adds the ".00" value to the text.


Like 10000 turns to 10,000.00.

abelingaw 69 Posting Whiz in Training

I'm having problem regarding a text box max length.

If i set it manually from the properties tab (i set it to 10), output would like

"10000000.0"

What i want is that it would be "1000000000.00". So i tried using this code:

Private Sub txtrate_LostFocus()

If txtrate.Text = vbNullString Then txtrate.Text = FormatNumber(0, 2)
txtrate.Text = FormatNumber(txtrate.Text, 2)

End Sub

But still doesn't work. Any idea?

abelingaw 69 Posting Whiz in Training

What i wanted to do is to limit the number of users to be registered for my system.

One for User type and one for Administrator account, and if there is already a user and admin account, adding will be disabled, else, enabled.

Here's the code im using.

Private Sub Usercount()

Con "Database.mdb"

With RecSet
    .Open "Select * From Users", DBLink, adOpenKeyset, adLockPessimistic
    
        If lvwUser.ListItems.Count = 2 And .Fields("UserType") = "Administrator" Then
            cmdAdd.Enabled = False
            cmdAdd.grayScale = aiGreenMask
            MsgBox "Limit of allowed users is reached. Adding of user is no longer allowed.", vbInformation, "Prompt"
        Else
            cmdAdd.Enabled = True
            cmdAdd.grayScale = aiNoGrayScale
        End If
        
       .Close
    
DBLink.Close

End With
End Sub

Any ideas? Thanks

abelingaw 69 Posting Whiz in Training

Ok, im kinda new to this but i did try.

Nagan = txtfname.Text
Mystring = "Insert into EmpRecord replace(Nagan," '", "''") Values ('" & Nagan & "')"

But the rest of the code just turns into a comment line (').
And where should I put it? Sorry, its my first time dealing with this.

abelingaw 69 Posting Whiz in Training

Ok, I'm having problem on how to save texts with quotes.
Let's say I'm saving a value in a textbox like O'Neil.

That's where I receive an error.
How do I save names or texts like O'Neil or texts with qoutes?

Here's my code for saving:

With RecSet
        .Open "Select * from EmpRecord", DBLink, adOpenDynamic, adLockOptimistic
    
        .AddNew
            
            .Fields("Name") = txtName.Text
                     
        .Update
            MsgBox "Record has been Saved", vbInformation

Thanks

abelingaw 69 Posting Whiz in Training

Is your SQL is on a command button (ex: cmdPrin Selected).?

abelingaw 69 Posting Whiz in Training

Here's what i have at the moment.

Private Sub Compute()

'lblhuam.Caption = DateTime.DateDiff("H", lbliam.Caption, lbloam.Caption)
'lblhupm.Caption = DateTime.DateDiff("H", lblipm.Caption, lblopm.Caption)

Dim Totam As String
Dim Totpm As String
Dim Totall As String

Con "Database.mdb"
With RecSet


    .Open "Select * from TimeLog where ID =" & Text1.Text, DBLink, adOpenKeyset, adLockPessimistic

    While .EOF = False
        
            lbldate.Caption = .Fields("DATE_LOG").Value
        
        If IsNull(.Fields("IN_AM")) = True Then
            lbliam.Caption = ""
        Else
            lbliam.Caption = .Fields("IN_AM").Value
        End If
        
         If IsNull(.Fields("OUT_AM")) = True Then
            lbloam.Caption = ""
        Else
            lbloam.Caption = .Fields("OUT_AM").Value
        End If
        
         If IsNull(.Fields("IN_PM")) = True Then
            lblipm.Caption = ""
        Else
            lblipm.Caption = .Fields("IN_PM").Value
        End If
        
        If IsNull(.Fields("OUT_PM")) = True Then
            lblopm.Caption = ""
        Else
            lblopm.Caption = .Fields("OUT_PM").Value
        End If
        
        Totall = Totpm + Totam
        
        Totam = Hour((.Fields("OUT_AM")) - (.Fields("IN_AM")))
        Totpm = Hour((.Fields("OUT_PM")) - (.Fields("IN_PM")))
        lblhuam.Caption = Totam
        lblhupm.Caption = Totpm
        lblmuam.Caption = Val(Totam) + Val(Totpm)
        
        .MoveNext
    
    Wend
    
    .Close

End With
DBLink.Close


End Sub

But it only computes the 2 fields. I would like to compute all the total hours of that employee for the whole 1 month.

abelingaw 69 Posting Whiz in Training

How do I add all time values in a database table to get its total, get the total tardiness then sum up to know how many days an employee is absent or present in a monthly basis?

abelingaw 69 Posting Whiz in Training

I have this

lblhuam.Caption = DateTime.DateDiff("H", lbliam.Caption, lbloam.Caption)
lblhupm.Caption = DateTime.DateDiff("H", lblipm.Caption, lblopm.Caption)

But i don't know how to separate the munite from the same data.

abelingaw 69 Posting Whiz in Training

Try replacing

con.Open "provider = microsoft.jet.oledb.4.0;persist security info = false; data source = " & App.Path & "\database1.mdb;"

to

con.Open "provider = microsoft.jet.oledb.4.0;data source = " & App.Path & "\database1.mdb; persist security info = false"

Try checking your ADO connection.

abelingaw 69 Posting Whiz in Training

I want to compute the difference of time values.
The values are loaded from my database (which are captured via biometrics) into labels.

Here's a screen shot:


And I would like also to separate the hour value and minutes then the computation.
Any idea where I will start.?

:)

Thanks

abelingaw 69 Posting Whiz in Training

In VB 6, textbox control doesn't have a bordercolor property, only backcolor and borderstyle.

However you can change the appearance to flat and just put a shape (rectangle) around the textbox and change the color in your preferred event.

Private Sub Command1_Click()
Shape1.BorderColor = &HFF& 'put your desired color
End Sub
abelingaw 69 Posting Whiz in Training

I have no idea on how to select multiple textbox at once (Run Time). But there are some properties which would look like you are doing it.

The Enable or Locked property for example, you can lock and enable multiple textboxes (or other controls in just one click.

PS: You can't do this using the Setfocus command because it will only set focus on the last textbox.setfocus statement that is on the last line of your code (if you try this).

abelingaw 69 Posting Whiz in Training

I think your missing the connection part.

Here:

'Put this in General Declaration area

Dim db As ADODB.Connection
Dim rs As ADODB.Recordset

Then have this where you want to create the connection

Set db = New ADODB.Connection
        db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\Database.mdb"
    
'Change Database to your database name

Set rs = New ADODB.Recordset
        rs.Open "Select DATABASETABLENAME from TABLEFIELD", db, adOpenStatic, adLockOptimistic

'DATABASETABLENAME is the table from your database
'TABLEFIELD is where you records be found

Or you can just do your connection by creating a module.

Public DBLink As New ADODB.Connection
Public RecSet As New ADODB.Recordset

Public Sub Con(Database As String)

DBLink.Provider = "Microsoft Jet 4.0 OLE DB Provider"
DBLink.ConnectionString = "Data Source=" & App.Path & "\" & Database
DBLink.Open

'Still the Database is the database name - rename it  to your own

End Sub

Then just call the connection on where you need it.

E.g in a form:

Call Con
abelingaw 69 Posting Whiz in Training

What part are you trying to connect your database to?

Is it the project or a datagrid or listview?

If it is your project, the link sir Andre has given will show the basics.

abelingaw 69 Posting Whiz in Training

From the code sir Andre given, just remove line 1 and 3.

abelingaw 69 Posting Whiz in Training

Done.. Working.

Thanks again.

abelingaw 69 Posting Whiz in Training

It does works sir but still get the error. Text is read only property It highlights here:

Form5.cboPost.Text = .SubItems(11)

I think its the text property since my combobox style is 2.

abelingaw 69 Posting Whiz in Training

Don't put the the code in the toolbar.

Place it in your command button (cmdUpdate) in your Modify form.

abelingaw 69 Posting Whiz in Training

Populate listview:

Call Con("Database.mdb")
    
    lvlEmpInfo.ListItems.Clear
    
    With RecSet
        .Open "Select * from EmpRecord", DBLink, adOpenKeyset, adLockPessimistic

        Do While .EOF = False
    
            lvlEmpInfo.ListItems.Add , , .Fields("Trans_ID")
    
            For i = 1 To 13
                lvlEmpInfo.ListItems(lvlEmpInfo.ListItems.Count).SubItems(i) = .Fields(i)
            Next i

            .MoveNext
        Loop
    
        .Close
    End With
    
    DBLink.Close

Populate Combobox:

Set db = New ADODB.Connection
        db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\Database.mdb"
    
Set rs = New ADODB.Recordset
        rs.Open "Select Post from Post", db, adOpenStatic, adLockOptimistic

Set cboPost.DataSource = rs


        'cbodept.DataField = "Office"
        Do Until rs.EOF
        
                cboPost.AddItem rs.Fields("Post")
            rs.MoveNext
        Loop

        rs.MoveFirst
        
        
        If rs.Fields("Post") = "Administrative Aide I" Then
            txtBasicRate.Text = "5000.00"
        End If
            

    rs.Close
db.Close

I have only one combo box sir, and its where i want to pass the values of the selected record from a column in the listview. Listview is first form and the combo box is on the second form.

When i load it via Edit command button, err appears saying the error i stated above.
As i said, i don't like changing the combobox style to 0 or 1.

abelingaw 69 Posting Whiz in Training

Put your code on the login form.

Example:

Splash.Show vbModal, Me

Then on your splash form after the timer control time is over (?),

Me.Hide
abelingaw 69 Posting Whiz in Training

Do you have any code on the datagrid?

Or just by clicking on the column header automatically sorts your records?

abelingaw 69 Posting Whiz in Training

It does.

But i want to load the current record on the listview into a combobox on another form.

And i can't because that error appears, I don't want to change the combobox style to 1 or 0.

abelingaw 69 Posting Whiz in Training

Try upgrading to VB 6..

abelingaw 69 Posting Whiz in Training

I have to edit an employee record so i have to load his record displayed from a listview in another form where I will edit it.

So that the combobox vale would be the same value as the listview column from the previous form.

abelingaw 69 Posting Whiz in Training

I want to load values from a lstview column to a combobox in another form.

The problem is that, my combobox style is 2 - Dropdown List and the values in it are from my database field. That's where the error occurs.

Saying Text property is read only. I could use the 0 - Dropdown combo style but users will be able to:

1. Write on it (fixed already using Keyascii = 0)
2. Enable users to copy paste. (by using the mouse)

I want to disable number 2 as well if you may.

I need help, any of the two may do..

Thanks.

abelingaw 69 Posting Whiz in Training

On your save button code, put this between line 26 and 28.

frmList.Adodc.Refresh
frmList.DataGrid1.Refresh
abelingaw 69 Posting Whiz in Training

Replace your module code with this.

Public CN As New ADODB.connection
Public rs As New ADODB.Recordset

Public Sub CON()
With CN
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "Data Source=" & App.Path & "\Database1.mdb"
     ' so that you dont have to specify the whole drive path of your database
     ' database should be in the same folder as your app
    .Open
    .CursorLocation = adUseClient
End With
End Sub

Replace your Save button code with this.

Dim rstInfo As New ADODB.Recordset
Dim SQL As String

Call CON

SQL = "SELECT * FROM List"

    rstInfo.Open SQL, CN, adOpenStatic, adLockOptimistic
        
        rstInfo.AddNew


            rstInfo!CustomerName = txtName.Text
            rstInfo!ContactNumber = txtContact.Text
            rstInfo!Date = txtDate.Text
            rstInfo!TimeStart = txtStart.Text
            rstInfo!TimeEnd = txtEnd.Text
            rstInfo!Event = txtEvent.Text
            rstInfo!PossibleNumberofGuest = txtGuest.Text
            rstInfo!Comment = txtComment.Text
            
            
    rstInfo.Update
    
         MsgBox "Record has been Saved", vbInformation
    
    rstInfo.Close

CN.Close
    
Set rstInfo = Nothing
abelingaw 69 Posting Whiz in Training

Show us some code or where the error occurs.

abelingaw 69 Posting Whiz in Training

Put it in your command button which save the data that is input in your controls.

Usually the saving button ( e.g cmdSave).

abelingaw 69 Posting Whiz in Training

Set your form Movable property to False on Design time.

You can also add this code to your form keypress event.

KeyAscii = 0

This will disable all keys from the keyboard (even mouse - not so sure). And yes, you should use a timer control.

abelingaw 69 Posting Whiz in Training

Just like i said, both of them will work..

abelingaw 69 Posting Whiz in Training

It still works either way.

Str(Sum)

You don't need to declare Sum and Str as string but it will still work

I really don't know why.

abelingaw 69 Posting Whiz in Training

Please mark thread as solve if your problem was solved.

Cheers!!

abelingaw 69 Posting Whiz in Training

@Sir Andre

@Abe, your code will not work. You need to declare the sum first -

It still works without declaring sir ;)

@sk8rock_15
Have a look at this, I included the code for the Picture controls.

Private Sub Command1_Click()

Sum = Val(Label1.Caption) + Val(Label2.Caption)
Label3.Caption = Str(Sum)

End Sub

Private Sub Picture1_Click()
Label1.Caption = "1"
End Sub

Private Sub Picture2_Click()
Label2.Caption = "1"
End Sub
abelingaw 69 Posting Whiz in Training

Use textbox control for input purpose, not label.

Have a command button control on your form first and put this code on it.

Private Sub Command1_Click()

Sum = Val(Text1.Text) + Val(Text2.Text)

Label3.Caption = Sum

End Sub

Please read the forum rules first if this is your first time posting here.

http://www.daniweb.com/forums/faq.php?faq=daniweb_policies

Cheers!!

abelingaw 69 Posting Whiz in Training

You should specify what field of the table what you are trying to get the data from.

Same thing if you are trying to display data from different fields in a control like textbox or labels.

Text1.Text = Rs.Fields("Lname") & " " & Rs.Fields("Fname") & " " & Rs.Fields("Mname")
abelingaw 69 Posting Whiz in Training
Fullname = Rs.Fields("Lname") & " " & Rs.Fields("Fname") & " " & Rs.Fields("Mname")

'if Fullname is also a database table field, change it e.g Rs.Fullname
abelingaw 69 Posting Whiz in Training

You could refer in this thread.

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

abelingaw 69 Posting Whiz in Training

Here's some fixes too.

On form5
on your Adodc1 control

1. Right Click
2. Click Build then on the First textbox where you enter your database path
3. replace the original path with inventory.mdb 4. Click Test COnnection button
5. Ok > Apply
6. RIght click on your Datagrid control then > click Retrieve Fields

And there you go, that message won't be disturbing you again.
Do the same on form 3 (Adodc2)

On form7 cmdAdd

At design time
Set cmbItemName property Style = 2 - Dropdown list
to disable typing on it

Replace your

If cmbItemName.Text = "Select an Item from the list" Then

to

If LenB(cmbItemName.Text) = 0 Then

At design time
Set txtQuantity property Enabled = True so that the Setfocus statement won't give you an error.

Replace your

ElseIf txtQuantity.Text = "0" Then

to

ElseIf LenB(txtQuantity.Text) = 0 Then

Here's an advice:

Practice naming your controls (with correct extensions e.g Command1 to cmdAdd or Text1 to txtName)
This is to make coding easier and avoid being confused