473,772 Members | 3,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check field in subform

8 New Member
I have a form with subforms on it (subforms are designed on tabcontrol and each has separate page)

After user enter information on form and tries to hit "Save" button i would like the access first to check if value in a subform field is not empty.

It is tblTakeOrder form. When user fills information on form with order id, client name and required date and try to save it - access needs to check SubForm "Order details" if orders price is typed in it

Trying to use this code but doesn't work:
Expand|Select|Wrap|Line Numbers
  1. Forms![TakeOrder]![Orderdetails subform].Form![Price].SetFocus
  2. If Me!Orderdetails subform.Price Is Null Then
  3.  
  4. MsgBox "Please insert price of the order"
  5. Else
  6.  
  7.     DoCmd.RunCommand acCmdSaveRecord
  8.  
  9.     End If
  10. End Sub
  11.  
Jun 2 '10 #1
3 7930
ChipR
1,287 Recognized Expert Top Contributor
To refer to a control on a subform with code on the main form, try this syntax:
Expand|Select|Wrap|Line Numbers
  1. Me!Subform1.Form!ControlName
Make sure that you replace Subform1 with the name of the subform control on the main form.
Jun 2 '10 #2
accessbeginerry
8 New Member
That worked, thank you.
Jun 2 '10 #3
msvenita
1 New Member
Thanks so much!

This was very helpful :)
Jul 20 '15 #4

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

Similar topics

15
24874
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that contains the subform is named Clients. I have this code in the Add Client btn: If Forms!Clients.subformVisits!VisitDirty = True Then MsgBox "Visit subform is dirty!"
8
10022
by: Steve Jorgensen | last post by:
There's this app I wrote a long time ago for a client who uses it to administer the database content that drives their Web site. Last time I was in there' I notices a lot of embarassing typos in the data, and since this data is published on their Web site which is their primary interface to their customers, that's a bad thing. I was thinking it would be nice if I could automatically spell check certain fields, and somehow use the Access...
3
2127
by: Rolan | last post by:
I need assistance regarding code needed to prevent someone from opening a form if a table field name(s) has been changed. For example, there is existing code to check for certain data based on DLookup in a table before a form can be opened. If one changes the field name in the table, then the verification check is bypassed. So adding code to DLookup to check for the existence of specific field names first is necessary. Any insight will be...
1
2752
by: sleepyant | last post by:
Hi, how can I check the field data type of a column in a Dataset table? Like whether it is a DateTime, a Binary or Character. Please help. Thanks.
1
1534
by: Simon | last post by:
Dear reader, I have a SubForm in witch appear some records as datasheet layout. I need to check of the SubForm is empty or not. I have tried the following code but it does not work.
2
12624
by: Simon | last post by:
Dear reader, I have a SubForm in witch appear some records as datasheet layout. I need to check of the SubForm is empty or not. I have tried the following code but it does not work. If IsNull(Forms!!) Then MsgBox "Form is empty select some records and try again.", vbOkOnly ,"Warning"
9
9700
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
3317
tuxalot
by: tuxalot | last post by:
I am using this code to perform spell checks (not sure where I got it, but it works a peach): Public Function SpellChecker(Calling As Form) On Error GoTo Err_SpellChecker Dim ctlSpell As Control Dim Incoming As String, Outgoing As String DoCmd.SetWarnings False
0
9620
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
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9912
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...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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.