473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Code in Subform

I have a form (Order Form) with a subform within it (Products subform1). I would like the ProductName and UnitPrice field to automatically fill in when you choose a SKU number. This works for the name and address in the main form but not in the subform.

This is what I have in the Event Procedure box on the SKU combo box:
Expand|Select|Wrap|Line Numbers
  1. Private Sub SKU_AfterUpdate()
  2.  
  3. Me![ProductName] = Me![SKU].Column(1)
  4. Me![UnitPrice] = Me![SKU].Column(2)
  5. End Sub
  6.  
What I'm I doing wrong. Do I need to reference the subform name somewhere?

Thanks
Mar 8 '08 #1
4 1208
JKing
1,206 Expert 1GB
Hi there,

There's a nice article in the Howtos section on referencing items in a subform. Here's the link: Referring to Items on a Sub-Form

If you have further questions afterwards please feel free to ask them.
Hope this helps you out,

Jking
Mar 8 '08 #2
I looked at the How To article on this, but I'm still confused. I have put the subform name in before the control name but it is still not working. Can someone help?

Thanks
Mar 8 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
I looked at the How To article on this, but I'm still confused. I have put the subform name in before the control name but it is still not working. Can someone help?

Thanks
It would have been helpful to show what you did put, because it should look like this:
Expand|Select|Wrap|Line Numbers
  1. Me![subformname].Form![ProductName] = Me![SKU].Column(1)
  2. Me![subformname].Form![UnitPrice] = Me![SKU].Column(2)
-Stewart
Mar 8 '08 #4
Thanks. I figured it out.
Mar 9 '08 #5

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

Similar topics

3
by: Earthling | last post by:
Any help would be appreciated to solve the following simple problem that I will describe. *** There is a form called "red chocolate form". The form has a particular subform field that has a...
2
by: Douglas Buchanan | last post by:
I set the OnExit property of the "Cost" field in subform "subJobDetail" to save the record (see below). Then I call a global sub to copy the )] calculated field to a field in the subform "subJob"....
1
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
6
by: Sally | last post by:
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried coding the Enter event of the subform control but...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
6
by: tlyczko | last post by:
I have a BeforeUpdate where I need to ensure that no matter what, the first four fields on the form (one text box, 3 combo box lists) have data entered in them before the user closes the form or...
6
by: cefrancke | last post by:
I've read up on Access and the limits of creating visible controls at run-time. I'm using Access 2003 and assume that it cant be done. I did find a clever method of having a main form (and in...
1
by: rdemyan via AccessMonster.com | last post by:
I tend to code everything. So I'm trying to set the recordset of a subform in code and then set the .ControlSource property of each field. The data is displaying correctly, but the subform isn't...
5
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.