Results 1 to 12 of 12

Thread: [RESOLVED] 3 problems...Can anyone help me?

  1. #1

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    Resolved [RESOLVED] 3 problems...Can anyone help me?

    Hi!

    My first problem is about a command button for browsing an image.
    I don't know how to make a command button that when you click the button, it will just browse.

    I made an Student ID form with an image using a data control. During runtime, I can't browse the image because I want to select an image for the student.

    If you still can't get what I mean, try clicking on the databasename on the properties window. The command button for browsing is what I'm asking for the code.

    The second problem is comparing the database names. Since I've created a Student ID form, of course I'll input their first names, middle names and last names. But what if the first name and last name was inputted twice? How do you prevent this? What is the code for searching the database for any duplicate names?

    My last problem is the Auto-Numbering of the student ID.

    Many thanks!

  2. #2
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: 3 problems...Can anyone help me?

    go to components and click microsoft forms 2.0 object library and use a button from there for the first problem

  3. #3
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: 3 problems...Can anyone help me?

    Quote Originally Posted by louvelle
    My first problem is about a command button for browsing an image.
    I don't know how to make a command button that when you click the button, it will just browse.
    Go to Components (ctrl+T) and add Microsoft Common Dialog control.
    Then add Picturebox and command button, copy/paste and run sample code below:
    Code:
    Private Sub Command1_Click()
        With CommonDialog1
            .FileName = ""
            .InitDir = "c:\"
            .Filter = "All Pictures (*.bmp;*.jpg;*.gif;*.ico)|*.bmp;*.jpg;*.gif;*.ico"
            .ShowOpen
            If Not .FileName = "" Then
                Set Picture1.Picture = LoadPicture(.FileName)
            End If
        End With
    End Sub

  4. #4

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    Re: 3 problems...Can anyone help me?

    I don't have a visualbasic at home but if I use the code, will it browse and place the image that I selected to the Image box?

    Sorry, just a new at vb6...

  5. #5

  6. #6

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    Re: 3 problems...Can anyone help me?

    Ahh.. I see.. Got any ideas on my second problem?

  7. #7

  8. #8

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    Re: 3 problems...Can anyone help me?

    I'm just using the data control...

  9. #9
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: 3 problems...Can anyone help me?

    Data control is something that helps you connect to your database and also manipulate your data.
    However, you must have DATABASE first - MS Access, MS SQL, Oracle, MySql, etc, etc, etc...
    Since you are completely new to working with databases I recommend you visit our Databse FAQ forum first.
    Without educating yourself on the the topic you won't get anywhere further than where you are now.

    Good luck.

  10. #10

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    Re: 3 problems...Can anyone help me?

    I've found my answer to my 3rd problem. Thanks.

    But I couldn't find anything about my 2nd problem..

    I'm using MS Access for my database...

  11. #11
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: 3 problems...Can anyone help me?

    I believe, you are having a form for entering student details ("StudentID form"). And it contains two text boxes named txtName and txtLastName, for entering first name and last name respectively. And a command button named cmdSave for saving the data into the database. Then you can use the following code for checking the the last name and first name..
    Code:
    Private Sub cmdSave_Click()
    If Trim(LCase(txtFirstName.Text)) = Trim(LCase(txtLastName.Text)) Then
        MsgBox "Both last name and first name are same..! Please change it..!", vbCritical, "Same..!"
        txtLastName.SetFocus
        Exit Sub
    Else
        'code for saving the data into the database
    End If
    End Sub
    Please keep in mind that, this code is for checking duplicates when you are adding a new data using the StudentID form and it will not check for any duplicates that has been already entered in the database.....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  12. #12

    Thread Starter
    Fanatic Member louvelle's Avatar
    Join Date
    Jun 2008
    Posts
    513

    Re: 3 problems...Can anyone help me?

    It's ok. I'll just input a code so that the data won't save... Thank you guys!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width