473,472 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Product Location Stumbling Block

RobH
56 New Member
I have a couple of tables.

tbl-SID - This Holds An ID for the different States/Country. (currently 20 ID's exist)
[StateID],[Country],[State]
0,Al,Al - This is aimed to be a single Item to depict all locations.
1,AU,ACT
2,AU,NSW
3,AU,VIC
4,AU,QLD
5,AU,SA
.
.
9,NZ,Auckland
10,NZ,Bay of Plenty

tbl-PL - This is a table that hold the location of a part
[PartID],[StateID]
1000,1
1000,2
1000,3
1000,4
.
.
.

I need to make a form that allows the Selection of StateID's for each part- However some parts are constant across all StateID's and in the event of adding a new StateID having to fo back across all parts to add these differenct StateID/PartID to the tbl-PL would be difficult.

I was thinking of having an "All" entry with a StateID =0 in State ID

My problem is how do i depict this on a form..
I was thinking in the form headers - having some fields to select the PartID
Then in the Details have a series of radio buttons or Check buttons for the 20 options - but im stumpted in how to to get the buttons to populate (which i could do Dlookups for) but then one the changes are made how would I re-allocate them? (other than do a sql cmd to remove all for the part and then another to add for each location selected - (this is where i'm Stumped)

Regards
Sep 15 '07 #1
3 1285
Scott Price
1,384 Recognized Expert Top Contributor
Sounds the like perfect situation to use an append query!

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl-PL SELECT tbl-SID.StateID, tbl-Parts.PartID FROM tbl-SID, tbl-Parts WHERE tbl-Parts.PartID = [WhateverPart#]
Test your select query first to make sure it's returning all StateID's, then add the INSERT INTO tbl-PL.

Regards,
Scott
Sep 15 '07 #2
RobH
56 New Member
Sounds the like perfect situation to use an append query!

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tbl-PL SELECT tbl-SID.StateID, tbl-Parts.PartID FROM tbl-SID, tbl-Parts WHERE tbl-Parts.PartID = [WhateverPart#]
Test your select query first to make sure it's returning all StateID's, then add the INSERT INTO tbl-PL.

Regards,
Scott

That would Work if I wanted to add every StateID into the Product Location Table - But I need to be able each one only if selected. or If All is selected - just the entry for all. On the form is a Check Box for each StateID location
Sep 15 '07 #3
Scott Price
1,384 Recognized Expert Top Contributor
Have you thought of using a multi-select list box to choose which states to add? You could put this on a pop-up form, sized to show all 20 states. When selecting one or more than one, place a command button to run the append query.

You'll then only need to catch the values returned by the list box, and pass them into the WHERE criteria of the append query.

This is a code snippet provided by our very own mmcarthy on how to retrieve values from a multiselect list box:

Expand|Select|Wrap|Line Numbers
  1.       Dim valSelect As Variant
  2.       Dim strValue As String ' just used for the demonstration
  3.  
  4.  
  5.           For Each valSelect In Me.listboxName.ItemsSelected
  6.               strValue = strValue & "'" & Me.listboxName.ItemData(valSelect) & "', "
  7.           Next valSelect
  8.  
  9.           ' to remove trailing comma
  10.           strValue = Left(strValue, Len(strValue)-2)
Regards,
Scott
Sep 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: YGeek | last post by:
Is there any difference between declaring a variable at the top of a method versus in the code of the method? Is there a performance impact for either choice? What about if the method will return...
7
by: Simon | last post by:
I've struggled manfully and have finally managed to subclass the Common Dialog class to add my own controls. My last problem is how to set the lpfnHook attribute of the OPENFILENAME structure....
8
by: YGeek | last post by:
Is there any difference between declaring a variable at the top of a method versus in the code of the method? Is there a performance impact for either choice? What about if the method will return...
12
by: Jack | last post by:
Since, I have not got some desired advise, I am reposting this for some asnwer/valuable suggestion. Thanks. THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE <% sql01 = "SELECT COUNT(*) AS...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.