Results 1 to 11 of 11

Thread: VB Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Location
    Coates, Peterborough, UK
    Posts
    6

    Exclamation VB Access

    Hi all this is the first time here.

    I'm trying get my program to search a database. I've been using a datagridview to display data from my database.

    i'm also trying to get it to let me add data to an empty space. I'm desperate for help.

  2. #2
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: VB Access

    Hi Welcome to VBF!
    is your search working fine...where do you get stuck...and what is the error if any...do you have any codings done so far...
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Location
    Coates, Peterborough, UK
    Posts
    6

    Re: VB Access

    I've just started with the basic form up and just need it to search a database for something and then display it on a different screen. I've got the info to display on the datagrid but that's about it.

    kinda new to vb just learning rite now and my course teachers suck

  4. #4
    Hyperactive Member
    Join Date
    May 2006
    Posts
    365

    Re: VB Access

    Hello,
    If you're using a datagrid then you must have created an ADO Data Control (6.0) embedded in the form! Am I right.

    If so to search the data on the control
    VB Code:
    1. Private Sub cmdSearch_Click()
    2.     Dim strName As String
    3.     Dim Book
    4.     Book = adodc1.Recordset.Bookmark
    5.     strName = InputBox("Please enter a Title")
    6.     adodc1.Recordset.MoveFirst
    7.     strName = "'" & strName & "'"
    8.     adodc1.Recordset.Find "Title = " & strName
    9.     If adodc1.Recordset.EOF Then
    10.         MsgBox "Title does not exist"
    11.         adodc1.Recordset.Bookmark = Book
    12.     End If
    13. End Sub

    This is a very simple search that calls an inputbox and then locates the first record that matches strName.

    To add a new record

    VB Code:
    1. adodc1.Recordset.AddNew

    The difficulty you will have using the Data Control is that there is only a single way to refresh the data and I believe that to be out of the scope of your course.
    Please also be aware that I am not going to do your coursework for you. The code above searches a data control relating to the data source given to the control at design time. Your data control will require a different a search under a different field within your control.

    Steve

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Location
    Coates, Peterborough, UK
    Posts
    6

    Re: VB Access

    thanks i'll work it out from here but might come and ask more questions later if i get stuck.

    btw i'm not expecting anyone to do the code for me I'd rather learn wot i need but our teachers don't know how to do the database part so our class is having to get outside help but thanks. just to let u know i'd rather work for it and not be spoon feed information
    when darkness falls then your computer has been turned off.

  6. #6
    Hyperactive Member
    Join Date
    May 2006
    Posts
    365

    Re: VB Access

    Hello again,

    apologies for not getting back to you.

    It is always a positive step to want to figure the program out for yourself as most people learn programming that way.

    Also when you are stuck just post your code, using the vbcode tagging system, and you will mugged by the many here who enjoy helping broken code get fixed.

    Regards
    Steve

    PS you will find a great amount of code available in the VB Classic FAQ .

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Location
    Coates, Peterborough, UK
    Posts
    6

    Re: VB Access

    kool thanks. I've had a look and tryed it but it won't recognise the "adodc1" it keeps telling me it's not declared so i donno if it's just visual studios 2005 being dumb or if i've done something wrong.
    when darkness falls then your computer has been turned off.

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: VB Access

    For working with databases, VB 2005 (which is VB.Net) is very different to Classic VB (VB6 etc), which is what sparbag assumed you were using.

    I'm afraid that like many others here, I don't use VB.Net myself, so unfortunately I can't help.

  9. #9

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Location
    Coates, Peterborough, UK
    Posts
    6

    Re: VB Access

    rite then thanks for trying.

    for all you out there help please.
    when darkness falls then your computer has been turned off.

  10. #10
    Hyperactive Member
    Join Date
    May 2006
    Posts
    365

    Re: VB Access

    Hello again,

    .NET at this level is certainly grabbing the dinosoar by the tail [sic].

    O'Reilly

    Generously donated code

    HTH

    Steve

  11. #11

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Location
    Coates, Peterborough, UK
    Posts
    6

    Re: VB Access

    thanks
    when darkness falls then your computer has been turned off.

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