+ Reply to Thread
Results 1 to 4 of 4

Using 1 form to manipulate 2 tables

  1. #1
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Canada
    MS-Off Ver
    Office 2013
    Posts
    120

    Using 1 form to manipulate 2 tables

    I'm not sure if I'm asking this right, but here goes:

    I have 2 tables that are independant, but some what dependant. I have made a form that is based on the first table (room/office numbers). Each room/office will have 1 to 12 data jacks (and in somecases more). The from shows a listbox listing of all the datajacks in the officespace. It also has a list box that looks up the room number in the datajacks table and displays the current datajacks associated with the selected room (current record)

    This all works as I have manually added some room numbers in the table, and they show up good. Now before you say why not base this off the datajacks, there is more management (such as other info about the room/office) that is done on this form already.

    Basically what I would like to happen is that when you doubleclick on a datajack number in the datajack complete listing, I would like to add the current room number to the datajack table under the selected datajack. When you double click on a datajack that is listed for the room, I would like to remove the room number from the datajack table.

    I can't seem to rap my head around how to do this...

  2. #2
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Canada
    MS-Off Ver
    Office 2013
    Posts
    120

    Re: Using 1 form to manipulate 2 tables

    hmmm... nothing yet?

    I tried creating a query for the two tables but they share a common field, the office number. This made the result un-satasfactory... So I have been looking into VB scripting the double click input. I have left the form with the Office table as the control source, and I have a list box that reads off the jack table. I'm going to search around a bit, but I guess what I am looking for is something like:

    1. take the double click value in the jack list box
    2. look up that record in the jack table
    3. take the office number from the current record selected on the table
    4. add the office number value to the office number field in the jack table
    5. refresh the jack listing for current office list box (this I have already)

    I have never really worked with manipulating tables outside of the current form control, so this is where I am a bit stuck.

  3. #3
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Canada
    MS-Off Ver
    Office 2013
    Posts
    120

    Re: Using 1 form to manipulate 2 tables

    Still nothing?

    Ok, I think I have the workings of how to do this, but I am getting an odd error:

    Run-time error 3061 - Too few parameters. Expected 1.

    here is the code:
    Please Login or Register  to view this content.
    the dbo_BoxNoQuery is a query that is run on access from a table stored on an SQL server. I have tried commenting out the FindFirst (and associated IF statement) to see if it is erroring out becuase of that, but it is not. Most lookups for this error on the net point to a type-o, but the name for the query is copy and pasted from the access objects list. It seems so close, yet just out of graps...

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Using 1 form to manipulate 2 tables

    Hi,

    This feels like you need a parameterized query to get at what you want. The idea is you build a query that returns the room if you physically type in the jack number. You build this query a few times by typing in the jack number and make sure it gives the correct room number back. Then, in place of the jack number you put a Parameter. This parameter needs to be the field name, from the form and record you are on, that is the jack number. The query then uses the current form and record to return the room.

    It is really hard to explain without a real example....

    See http://office.microsoft.com/en-us/ac...001117077.aspx or
    http://www.gcflearnfree.org/access2010/extra/72 or
    http://www.fontstuff.com/access/acctut01.htm

    or more reading.

    If you know about all this stuff and it still doesn't help then I'd need a sample file.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1