Results 1 to 2 of 2

Thread: DB Code: Please help!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    HI,
    I'm new at databases and need some help. Can anyone share some code that would allow me to see 1 record from each of two fields of a table in two textboxes respectively, and then in two more textboxes type new info to be entered into another table(might be empty) where a common ID number must be created in it the same as the existing info in the first two textboxes.
    I'd prefer doing this without the datacontrol. Any DAO or ADO help will keep me from being DOA at a meeting tomorrow.
    I'm in your debt already,hopefully someday I can repay you all. Just make a list.
    Thanks Again
    Joey O

  2. #2
    Guest

    Cool

    Ok try this sort of thing, at the top of your code window where you make declares. (You must first do a reference to MS Data vers 35/3

    Private db as Database
    Private rs1 as recordset
    Private rs2 as recordset

    In the form load

    Set db = dbengine.opendatabase(Path and name of base)
    set rs1 = db.openrecordset(Table1,dbopendynaset)
    Set rs2 = sb.openrecordset(Table2,dbopendynaset)

    Ok after you have located the record you want

    txtbox1 = rs1!Name1
    txtbox2 = rs1!Name2

    Type in your info in txtbox3 and txtbox4\

    then to load rs2 something like

    rs2.findfirst("Key = '" & rs1!Key & "'")
    if rs2.nomatch then
    rs2.addnew
    rs2!Key = rs1!Key
    else
    rs2.edit
    end if

    rs2!Whatever = txtbox3
    rs2!Whatever = txtbox4
    rs2.update

    Hope this helps, abit confusing l know don't have vb in front of me on this pc. :0


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