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

Set focus to a particular field on a subform

46
Hello,

Suppose I have a form (call it "form1") with two tabs. On tab1 I have a button that I would like to set the focus on a text box, call it "txt1" on a subform (call it "subform1") which is on the second tab, call it tab2.

[forms]![form1]![tab2]![subform1]![txt1].setfocus doesn't seem to be working. Any suggestions? Thank you!
Jan 9 '08 #1
5 7989
Rabbit
12,516 Expert Mod 8TB
Hello,

Suppose I have a form (call it "form1") with two tabs. On tab1 I have a button that I would like to set the focus on a text box, call it "txt1" on a subform (call it "subform1") which is on the second tab, call it tab2.

[forms]![form1]![tab2]![subform1]![txt1].setfocus doesn't seem to be working. Any suggestions? Thank you!
Expand|Select|Wrap|Line Numbers
  1. Me.subform1.Form.txt1.SetFocus
Jan 9 '08 #2
bbatson
46
Thank you for the reply, but I notice that "subform1" does not autofill after typing "me.". As such, when I try to run this command it says the object is not found. Is this because it's on the separate tab? If so, how can I remedy this?
Jan 9 '08 #3
Rabbit
12,516 Expert Mod 8TB
No, you don't need to refer to the tab when referring to controls on a tab. It should autofill assuming that the function is in the form's code module and that subform1 is the name of the subform control, not the name of the subform. They are separate things.
Jan 9 '08 #4
bbatson
46
Thank you.

To simplify, suppose I have a form (Form1) with two tabs (Tab1, Tab2). On both tabs there are subforms. Upon double-clicking of a certain field on Tab1 (within the subform), I'd like Tab2 to be selected, and the focus set to a certain field, call it 'Tab2Field.' What would be the code behind this?
Jan 18 '08 #5
Rabbit
12,516 Expert Mod 8TB
You would use:
Expand|Select|Wrap|Line Numbers
  1. Me.Parent.FieldName
  2.  
Like I said earlier, you don't need to reference the tab name when referring to the controls on that tab. Just ignore what tab it's on.
Jan 18 '08 #6

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

Similar topics

3
by: Steve Miles | last post by:
I've got a tabbed form with the 2nd tab containing a subform. I'm trying to avoid the need to use the mouse to set focus to the first field on the subform. I can use <CTRL><TAB> to open the 2nd...
2
by: S P Arif Sahari Wibowo | last post by:
Hi! Do you know how to put a form's Access-Visual-Basic-code that will force the form to be inserted, while the user has not type anything in the form, without changing focus, selection, etc.? ...
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...
2
by: James | last post by:
Hi I have set up a subform in datasheet mode containing a second subform also in datasheet mode in order to be able to open it as a subdatasheet. In my application I make the first subform...
1
by: Reginald Bal | last post by:
Main Form/SubForm When I requery or recalc my parent form after I updated a record in my subform, I lose the focus of that particular record in my subform. Instead, the first record is selected....
1
by: kaeldowdy | last post by:
This one is stumping me! I have a Form/Subform arrangement. The main form is set as a Single Form and the sub form is set as Continuous Forms. On the Form_AfterUpdate event of the subform, I...
1
by: google | last post by:
I have a form with several subforms. Users enter the data, then on the parent there is a command button that runs code to generate a .pdf document from a report based on the data they are working...
2
by: christinamasalha | last post by:
Hello again, Im hoping somebody can help me with this problem :) In my database i have a from called "Farms", on the from i have 1 fields called "Farm_Name" and a subform called "Houses". When...
16
n8kindt
by: n8kindt | last post by:
ok, i have a fairly complicated form that goes three forms deep. i've been avoiding this particular dliemma for a while hoping the answer would come to me in a dream or something but i think it's...
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...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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...

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.