473,385 Members | 1,523 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,385 software developers and data experts.

moving focus on the subform from the main form

12
Merry Christmas to everybody.
I have a main form and a subform, a button on the main form which will act if a condition between 2 controls in the subform satisfies. If the condition does not satisfy the focus will go to one control. I have applied If-Then vba code and setfocus on the subform and thereafter on the control of the subform. But the control could not be found in the program when I run the program. Please suggest or any link where it has already been explained. Thanks a lot.
Dec 25 '16 #1
3 1073
gnawoncents
214 100+
Please include the names of the form, subform, and controls in question and post the code you are trying to use that is problematic. That way we can better understand what the problem might be and suggest an appropriate fix, example, or tutorial.
Dec 28 '16 #2
nndkol
12
I have 2 tables – “Allotment” & “Release”( both have auto-numbered Primary key as AllotmentID & ReleaseID). The table “Release” has a field with AllotmentID such that every entry in the table “Release” is connected to the table “Allotment". For each AllotmentID there may be many ReleaseID. I have made a main form “frmAllotment” connected with table “Allotment” and a subform “sfrmRelease” connected with table “Release”. The main form has a combo box –“cmbAllotmentID” and one button to exit; the subform has 2 textboxes- txtRelAmt( for [ReleaseAmount] in the table “Release”) and txtApproveAmt( for [ApprovedAmount] in the table “Release”). These are bound form and subform. If I select AllotmentID from the combo box in the main form, the subform will automatically populate data related to that AllotmentID. If there are many records in the subform, I can navigate to the next record in the subform from the built-in navigation button and even create new record with new “ReleaseID” in the subform. The data are autosaved and it works perfectly as per my requirement.
Now I want the condition that txtRelAmt <= txtApproveAmt. The data will not be saved if this condition is not satisfied and the exit button will not allow to exit and the combobox will not allow to select another AllotmentID. And the focus will be on txtRelAmt . But it does not work. Kindly help.
Dec 29 '16 #3
gnawoncents
214 100+
There are a few ways to handle this, but the simplest by far would be to add a validation rule to txtRelAmt. The one below should suffice and will not allow the user to continue until the amount in txtRelAmt is less than or equal to txtApproveAmt.

Expand|Select|Wrap|Line Numbers
  1. <=[txtApproveAmt]
Dec 29 '16 #4

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

Similar topics

9
by: chris vettese | last post by:
On my subform I have a field in the footer that totals the value of a field. On the main form I have referenced this field. I'm using this field in a calculation on my main form. The problem...
17
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
7
by: Stu | last post by:
Hi, I have a combobox who's values change the recordsource of the form. Within this form, there is a subform, whos records also need to change pending the value in the combobox. I am able to get...
2
by: Tom | last post by:
I am developing a VB.NET user control that is composed of a component control (along with some classes, etc). This is probably a stupid question, and should be easy, but I must be having a brain...
0
by: jvitti | last post by:
I recently upgraded from Access 2000 to Access 2007 and I am having trouble with moving the focus from 1 form to another. While doing data entry if a similar claim is found the claim view form...
2
by: bigukfan | last post by:
I have an application that is used to collect clinical data from hospital patients involved in research. Various forms are used to collect specific data, often blood results. When the users enter...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.