Hi
I have a form called 'shiftviewer' and it contains a subform called 'all shifts for current month subform'. the subform is in datasheet view (access 2007) and the main form is a column orientated form.
Both forms contain records of 'shifts'
I want to be able to select a record (a shift) in the subform, and be able to set the parent form's current record to that record, through the identifying primary key that a shift record has (ShiftID)
I am semi capable of visual basic so hit me with it..
thank in advance
8 18198
you could use some code in the subforms on current event to alter the parent forms recordsource. - Private Sub Form_Current()
-
Me.Parent.Form.RecordSource = "Select [myTable].* From [myTable] Where [myID] = " & Me.myID
-
End Sub
That's the simplest way I can think of.
Megan
Thanks thats working pretty well, not got it fully working, but will post when i'v had time. How to SELECT from myquery, not mytbl?
NOOOO!!
I accomplished what i wanted, but now, in the main form, all the controls are UNEDITABLE!
This defies the object. The code i put into the subform's current function is below: - Me.Parent.Form.RecordSource = "Select [personAndTime].promoID,[personAndTime].date,
-
[personAndTime].time, [personAndTime].VenueID,
-
[personAndTime].ActivityID,[Activities].rate,[Activities].hours,
-
[Activities].otherPayments
-
From [personAndTime],[Activities] Where [ShiftID] = " & Me.ShiftID
The subform is however editable, not this is not necessary, what i wanted was to only be able to edit the subform through the main form...
thanks megan for so far...
NOOOO!!
I accomplished what i wanted, but now, in the main form, all the controls are UNEDITABLE!
This defies the object. The code i put into the subform's current function is below: -
Me.Parent.Form.RecordSource = "Select [personAndTime].promoID,[personAndTime].date,[personAndTime].time, [personAndTime].VenueID,[personAndTime].ActivityID,[Activities].rate,[Activities].hours,[Activities].otherPayments From [personAndTime],[Activities] Where [ShiftID] = " & Me.ShiftID
The subform is however editable, not this is not necessary, what i wanted was to only be able to edit the subform through the main form...
thanks megan for so far...
That's because you're selecting from a query not a table.
What I don't understand is the way you have this set up. The logic of changing a record on a main form based on the selection in a subform is the reverse of what is normally done. The best advice I can give is to open a new form instead with the appropriate record which should be editable.
Mary
That's because you're selecting from a query not a table.
Mary
I believe i am selecting from tables only. Activities and personAndTime are both tables. correct me if i am in the wrong.
The rational behind this form is that the user selects the item they want to edit from a datasheet subform, listing all the records in a viewable table format. the editing i want to have done must be done through the controls in the main form. but thats neither here not there.
Could you please explain why i cant edit the controls, if Activities and personAndTime are indeed tables, my FROM parameters. The subform however, is based on a query, so maybe im answering my own question...
I believe i am selecting from tables only. Activities and personAndTime are both tables. correct me if i am in the wrong.
The rational behind this form is that the user selects the item they want to edit from a datasheet subform, listing all the records in a viewable table format. the editing i want to have done must be done through the controls in the main form. but thats neither here not there.
Could you please explain why i cant edit the controls, if Activities and personAndTime are indeed tables, my FROM parameters. The subform however, is based on a query, so maybe im answering my own question...
Your tables are being accessed through a query. When you put the further criteria on this query to bring up the new record the query becomes uneditable.
Mary
Sorry for the confusion I only tested the code on a form bound to a table not a query on two tables. Probably adding criteria to the query makes the recordset unupdateable
The following code should work and doesn’t alter the record source.
In the subform’s on click event: - Private Sub Form_Click()
-
DoCmd.GoToRecord acDataForm, "MainForm", acGoTo, Me.Form.CurrentRecord
-
End Sub
There’s probably at least a dozen other ways to do this if this one doesn’t work for you.
thanks, worked it out you ppl r, once again, legends
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Phil Matish |
last post by:
I would like to know if the following is possible:
I have a form and a subform. In the subform, there are records
summarized. (For ex, instead of showing all 19 fields, I only show 3 to
save...
|
by: Lyn |
last post by:
Hi,
I am working on a genealogy form. The only table (so far) lists everybody
in the family, one record per person. Each record has an autonum ID.
The parent form (frmMainForm) displays the...
|
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...
|
by: New2Access |
last post by:
Hi,
I have a form thats used to enter records into a table. The table and
form have fields for Name, week, project, and hours. To assist users,
I wish to add a subform that will show them how...
|
by: Darryl Kerkeslager |
last post by:
I don't do much with subforms - in fact I've deliberately avoided them - but
....
I have a tab control that will contain several subforms, each bound to a
separate table, and each table/subform...
|
by: Kathy |
last post by:
What is the standard technique for handling the fields in the following
scenario on a continuous form?
Multiple Divisions. Each Division has multiple Buildings. Each Building has
a Supervisor.
...
|
by: MLH |
last post by:
When the vehicle entry form (frmVehicleEntryForm) first opens, the
additional owner SubForm control (frmAddnlOwnrListSubForm) is
enabled. You can click on it and it will accept the focus. But after...
|
by: Harlequin |
last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase...
|
by: troy_lee |
last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with
another table (Table B). I am having trouble with a form/subform setup
to view the 1:M records.
On the parent form, there is...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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,...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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...
|
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,...
| |