Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2013
    Posts
    4

    Exclamation Unanswered: Urgent Help needed

    I Have 4 tables and I want to build a form in access in which I want to search for a particular string from all the 4 tables. So how should I build the search query in the form and link the data to be searched from the 4 tables. the 4 tables are by software, by user, component, standard. Also after displaying the particular searched string I want to delete it. Is there any query to directly delete it after it is displayed?? I am an Power electronics student and I am unaware of access.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why would you have possibly the same data in 4 separate tables?
    from what you say so far I'd expect 2 tables
    one defines the source or origin, and that is used as a foreign key in your other (mand) data table
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Aug 2013
    Posts
    4
    I dnt have same data in all 4 tables thats why want to check if there is any common data and that should be displayed. so how should i do it

  4. #4
    Join Date
    Aug 2013
    Posts
    4

    Exclamation hwlp required

    I Have generated a form in ms access and i need the query for search button. The onclick procedure should search for the string from all the tables. is it possible or it can only search from 1 master table having primary key. do help

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    there is no way to my knowledge of doing what you want, especially with the added burden of deleting in one step. the closest you will get to that is using a stored procedure.

    this sort of question makes me feel that the basic design isn't right hence my earlier response


    what you could do is create a form which accepts the user input. then the user presses a button which executes what is essentially the same query against all 4 tables, returns the results, and deletes if required.
    strSQL = "select my,column,list from mytable"
    strSQl = strSQL & " where atextcolumn like '%whatever you are looking for%'"

    change the column and table names as required
    if whatever you are looking for is coming form a control say MyTextBox then
    Code:
    strSQL = "select my,column,list from mytable "
    strSQL = strSQL & "where atextcolumn like '%" & myTextbox & "%'"
    the % is the wildcard used for text matching in ANSI SQL, depending on your Access settings you may need to use the * symbol instead

    having found rows you then delete using a variant of the select

    replace the select my,column list with delete *

    eg:
    Code:
    delete * from mytable where  atextcolumn like '%" & myTextbox & "%'"
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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