473,748 Members | 7,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing keys or values from one subform to another by double clicking

9 New Member
I have searched forever trying to solve a problem that simplifies recurring info inputs to my database

the basic structure is Orders tbl main form and pricing_tbl subform and third when orders have recurring pricing structure, query pricing history for location and product, then select appropriate costing method from filtered list. This historical data sheet (subform 2) would be optional method for populating costing.

I have run across junction tables as a solution but it could potential cause problems if someone changes the historical costing methods. another way of saying this is that if I'm linked to a historical record associated with a given customer or customers then potentially all customers associated with that pricing method change.

pricing is based on base components (materials) 70% a 30% B the actual unit price is based on market indexes which change monthly.

Ideally I would like to be looking at new record (order) on the main form. Query or filter for costing methods for that plant (refinery) and product. Click or double click on the above pricing method and pass the sequence number (similar to junction method) or pass component_A, component_A_Per cent, component_B, component_b_per cent, etc. to subform 1 which is where you manually enter this information.

Usually I can figure out VBA but am not particulary adept with it. I find Cold Fusion simplifier because I don't have to deal with visual methods. A simple example or general direction would be greatly appreciated.

Here is my feeble attempt to store a value from the double click

Private Sub Form_DblClick(C ancel As Integer)
Dim price_seq As Integer
Me.RecordSource = "standard_prici ng_tbl"
Me.intSequence. ControlSource = "Pricing_method _seq"
price_seq = Pricing_Method_ Seq
End Sub

MP
Oct 26 '07 #1
13 3287
nico5038
3,080 Recognized Expert Specialist
Hmm, complex description. I guess you're describing what we call a "Bill Of Materials" (BOM) costing method.
This requires "recursive" programming using the product structure and the costs.
Building such a (basically a tree-) structure requires testing each branch not to hold the same products, as that will create an "endless" loop.

How did you organize your Product table to enable the relation between the products ?

Nic;o)
Oct 27 '07 #2
jmpigott
9 New Member
Just to give some clarity

there is an orders table primary keys order item

transfer cost which is internal cost or internal price has a one to one relation to the orders table

One thing I should have mentioned is that there are never or rarely more than two components. Therefore one to one. I would have liked to make it more flexible with one to many but this case it should be acceptable.

historical pricing methods is just a unique subset of plant, product pricing methods it has an autonumber field providing a unique identifier

Ultimately i update the calculated price to the orders table to ensure a static price

I have yet to find the simplest method and realize this is a little clunky

My problem is generally understanding objects, states, focus and referencing them.

I did come up with an alternative method which involves adding a checkbox field to filtered historical pricing methods. returning the record value of the checked record to form by parameterizing the order item, combining it with the pricing components in an append query.

Then i would reload the form to that record and the pricing method would show up where it would be manually entered.


Again referencing the order item from the form to build the query and how I reload the form to previous state plus the pricing methods is yet to be accomplished. I have worked a lot with Access but not much automation or form usage.

I apologize if I sound vague. Tried to simplify to standard database table names while the actual tables aren't orders or order details. I can't see what I wrote the first time nor exactly what you said from this reply screen.

BOM is generally correct, though since the operative order detail is item level. It is the items that compose the order item. Apologize for the confusion ; ). Been a learning curve for me as well. SAP doesn't handle this correctly so I am creating a double entry method but trying to use SAP where it is accurate and allow a user to create a monthly P&L with minimal effort. There are about 108 order items a month and additional details so putting in one month was onerous.

thanks for the response
Oct 27 '07 #3
nico5038
3,080 Recognized Expert Specialist
Hmm, still some trouble to understand the processes involved.
Your initial question is rather easy to achieve as just storing the value in a "bound" field will cause Access to store the value when you close the form.
Storing the final calculated price is the way to go when the basic values (like the prices) are changing overtime. Alternatively to this you could chose for storing the prices with a start- (and/or end-) date. This will make the result verifyable, but harder to determine the price as a date is needed to extract it.

The determination of the values in subforms is with your additional checkbox field rather easy to achieve by doing a Sum on the rows having a YesNo field set to true. For this a query can be created referencing the formfield holding the Unique ID.

More difficult is the part with the different calculation methods. I get the impression the user can select the different items and your form adds them, I'm missing the real BOM property, being the different levels as items can be linked to other ("lower") items.

Nic;o)
Oct 27 '07 #4
jmpigott
9 New Member
I'll put something together definitive and concise shortly. Misplaced by USB drive so I'll have to refer to older version. See if I can past a relationship view and form view.
Oct 27 '07 #5
nico5038
3,080 Recognized Expert Specialist
Just open a comment here with the [Edit/Delete] link at the bottom and you can add an attachment.

Nic;o)
Oct 27 '07 #6
jmpigott
9 New Member
Nico,

I tried uploading some images but ran up against the 75k limit. I don't have a good image editor. Tried zipping a few formats and other compression, no dice. Haven't used snapshot view for a while. Will look into that.

For the moment I'll just see how far I can get then at least my question will be more specific.

Thanks for your help.
Oct 29 '07 #7
nico5038
3,080 Recognized Expert Specialist
Try to make a small test .mdb and (after compacting) zip it.
Just a small sample will do.

Nic;o)
Oct 29 '07 #8
jmpigott
9 New Member
Nico,

Again thanks for the options. I have made some progress in my simplified method. I can display related historical pricing using a product relationship and a refresh once the plant_Of_Origin is selected (doesn't come straight from SAP).

I created a command button which called the main form primary keys in running a query but I can tell it is passing null values. So the update query isn't working.

I'd love to share a simple sample. However, we have pretty strict security and while I came up with some relationship and form views, now I can't attach them from work. Similarly I used ODBC tables for some of the queries so it will capture any changes or additions.

So what would be the best way to pass order and order item from the main form to an update query.

I used the below as a criteria after trying to using to update the field

[Forms]![Review_and_Modi fy_Transactions _frm]![DOC_NO]
[Forms]![Review_and_Modi fy_Transactions _frm]![Item_num]

after I choose the plant of origin in the subform which is based on the transfer_cost_t bl. The record already exists it just needs the component pricing structure.


If this does not make any sense. No worries. I'm pretty sure the above method is fundamentally wrong. I need continuity from the form to the query. So I'm looking to make these parameters available to the query. Some sort of temp variable.

Private Sub Apply_Historica l_Pricing_Btn_C lick()
On Error GoTo Err_Apply_Histo rical_Pricing_B tn_Click

Dim stDocName As String

stDocName = "Apply_Historic al_Pricing_Meth od_qry"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Apply_Hist orical_Pricing_ Btn_Click:
Exit Sub

Err_Apply_Histo rical_Pricing_B tn_Click:
MsgBox Err.Description
Resume Exit_Apply_Hist orical_Pricing_ Btn_Click

End Sub


thanks. I believe the below will get me there.

''' Keywords: MOTOR DELETE
'''
''' Date Developer Action
''' -------------------------------------------------------------------------
''' 8/09/96 Marty Wasznicky created

On Error GoTo RemoveMotorID_E rr

Dim intSelected As Integer
Dim lngMotorID As Long, lngCustId As Long
Dim qdfMotorDelete As QueryDef
Dim errdata As gTypeErr
Dim strProcName As String * 255
strProcName = "RemoveMoto rID"

''' Check if motor selection was made
intSelected = lstMotorSelect. ItemsSelected.C ount
If intSelected < 1 Then
MsgBox "You must first select a Motor."
Exit Sub
Else
''' If there is a selection, store it
lngMotorID = lstMotorSelect. Column(0)
End If

''' If there is a selection, store it
lngCustId = txtId

''' Open querydef, passing it the CustID and MotorID as parameters
Set qdfMotorDelete = CurrentDb.Query Defs("qdelCustM otor")
qdfMotorDelete. PARAMETERS!Cust omer = lngCustId
qdfMotorDelete. PARAMETERS!Moto r = lngMotorID

''' Execute querydef
qdfMotorDelete. Execute

''' Requery listboxes
Call RefreshLists

RemoveMotorID_E xit:
Exit Sub

RemoveMotorID_E rr:
Call ErrSave(errdata )
Call ErrorMsg(errdat a, Trim$(strProcNa me), varIcon:=vbExcl amation)
Resume RemoveMotorID_E xit
End Sub

Mike
Oct 29 '07 #9
nico5038
3,080 Recognized Expert Specialist
From code you can issue an update like:
[code=vb]
currentdb.execu te ("UPDATE tblX SET DOC_NO =" & Me![DOC_NO])
[code]

Nic;o)
Oct 29 '07 #10

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

Similar topics

5
2800
by: Eric A. Forgy | last post by:
Hello, I am just learning Java and am trying to write a method that does something like //=========================================== public Static List find(double array,double val,String relationalOp) { List list = new ArrayList();
12
6557
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
1
5097
by: bentond | last post by:
I am trying to write a simple form that allows a user to search through an address table. The main form has the text boxes (to be used as where parameters) and when clicking the search button will create an sql string that is to be used as the recordsource for the subform. The subform is requeried and all is apples. However I can't work out how to do this when the recordsource for the subform has to be a pass through query. I have a...
11
8128
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line number) which is the last line of the following sub routine: ' procedure modifies elements of array and assigns ' new reference (note ByVal) Sub FirstDouble(ByVal array As Integer()) Dim i As Integer
14
3465
by: vatamane | last post by:
This has been bothering me for a while. Just want to find out if it just me or perhaps others have thought of this too: Why shouldn't the keyset of a dictionary be represented as a set instead of a list? I know that sets were introduced a lot later and lists/dictionaries were used instead but I think "the only correct way" now is for the dictionary keys and values to be sets. Presently {1:0,2:0,3:0}.keys() will produce but it could also...
5
2304
by: MOC835 | last post by:
I have calendar control that I am trying to use on a continuous subform to select two dates. My MainForm collects user data, and the continuous SubForm collects two dates for that specific user...an IssueDate and a ReturnDate. I am trying to give the user the option of entering the date into the date field text box, or clicking a button next to the text box to open a seperate form with a calendar in it (frmCalendar).
9
9696
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
3
4969
by: Buckaroo Banzai | last post by:
Hi, I just started learning JAVA and I'm really NOT sure how to manipulate values in different classes. for example. I have a class 'class1' which updates some variables for its own use. then I have another class 'class2' which should take the result of the computation in 'class1' and use that value to perform some other operations. I then have the main program file in a separate file that returns the result of the two classes. is this...
4
4968
by: hlebforprimeminister | last post by:
Hi I am having trouble with some forms i am creating for a database. I have a data entry form at the moment that enters information into one table and a subform within the form that enters information into another table. The subform takes the primary key, which is an autonumber, from the main form, as the subform puts information in a table which is linked to the table that the main form puts information into. My problem is that I...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9321
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4602
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
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 we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.