Subform Name Path - New Record Macro
Mar 2, 2005
I've got a form with a subform on it that has a subform on it (nested subforms - Customers form with computers subform, which has a software licenses subform on it)
I'm trying to put a button on the top-level customers form that will jump to a new record in the software license subform-subform (the licenses form is displayed as continuous with a blank at the end for new license entry). I want to set the OnClick action to move the record selector on the software licenses subform to the last (new) record in the continuous form display. I can't figure out the appropriate path to use as the Form Name in my GotoRecord macro.
Is there a special trick to use when referencing subform controls?
Slaughter
slaughter at mizzou dot edu
View Replies
ADVERTISEMENT
Aug 24, 2006
Hello, fantastic site you have here!
I have a form based on a table called TermWithPaysStoredData that shows a single row for everyone in the table with a small amount of info from the table and has controls for a user to enter dates which writes to that same table.
I have a subform that reads that same table but has much more information about each row. I would like to add a button to each row of the main form that says "More Info". When clicked, it should open the subform to the same employee.
The field I want to match is called ID. My main form is called fTermWithPays and my subform is called fTermWithPaysMoreInformation.
I tried using the OpenForm method but that either opens the form to the first record or filters and shows only one blank record.
I'd like to use a macro for this if possible because I don't know VB.
Any ideas? Let me know if more explanation is needed.
Thanks very much!
View 2 Replies
View Related
Jun 15, 2015
How to add attachments to a email using a sub form were I store the attachment paths
E.g I have a main form called frmteaminfomer with various fields and continuous subform called attachmentssubform in the sub form I have a field call txtaddress . I have some code that I can pick a file then put its file path into txtaddress field and also have a check box call add to email. so what I trying to do is loop through all the records in the subform and if the check box is true add the files as attachment on the email.
View 14 Replies
View Related
May 26, 2014
Till now I managed to publish and save all in C:Reports. What I'm trying to do is Save to path specified in Path. DB attached.
Private Sub PrintAll_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim MyPath As String
Dim MyFileName As String
[Code] ....
View 6 Replies
View Related
Nov 2, 2006
I have a form named frmtestpkg which has a subform named pkgsubform. The control the subform is in is called pkgsubform1. I have written a macro which works very nicely to hide or show the field [Days2process] if I attach it to "on current" on pkgsubform and open pkgsubform as a form. If I try to open pkgsubform as a subform I get a message stating "The object you referenced in the Visual Basic procedure as an ole object isn't an ole object."
How do I change my macro to refer to the form and controls as a subform?
my Macro looks like this:
condition: [Forms]![Pkgsubform].[CrPkgStatus]<>"Accepted"
Action: SetValue
Item: [Forms]![pkgsubform]![Days2Process].[visible]
Expression: No
condition: [Forms]![Pkgsubform].[CrPkgStatus]="Accepted"
Action: SetValue
Item: [Forms]![pkgsubform]![Days2Process].[visible]
Expression: Yes
View 2 Replies
View Related
Jul 8, 2013
I have a sub form that contains two fields of FabricNum(ComboBox) and RollNum(ComboBox). The RollNum is restricted to the FabricNum so whenever I choose a FabricNum, list of RollNum changes respectively.
In order to do that, I created a query that contains the FabricNum and RollNum. The FabricNum in the query is restricted to the chosen FabricNum in the subform. I also have an embedded macro on FabricNum which opens the query, close the query and requery based on RollNumber. All what I have explained work perfect once it gets done in a sub form. When I try to do the same thing in a Main form, it does give me an error.
After researches I realized that I have to change the path in a query and I changed it as following:
[Forms]![FabricUsageDetail1].[FabricUsageDetail2].[Form].[FabricNum].
Unfortunately, I still get an error of 2950 which says the command or action "Requery" is not available now.
View 12 Replies
View Related
Sep 10, 2012
I have created a form with a subform.
When opening the main form I would like to create a macro that is able to set the property visible/not visible for a certain field if a certain condition on another field is satisfied. I Have Office 2010 and with the macro editor I'm not able to make it work. Need writing the text as in the macro editor?
Here below the example:
Main form name: FORM_1
Subform name: SUBFORM_2
Subform field: FIELD_ABC
Subform field: FIELD_123
Subform field: FIELD_CHECK
Opening the form FORM_1, the macro must show the field FIELD_ABC and hide the field FIELD_123 only if FIELD_CHECK is equal to "TEXT OK" ...and the macro must hide the field FIELD_ABC and show the field FIELD_123 only if the field FIELD_CHECK is equal to "TEXT WRONG".
I would like to use the same macro on a report.
View 7 Replies
View Related
Aug 12, 2015
I have a parent form and a sub-form. On the parent form is a date field [JOINED] and on the sub-form there is a date field [DATE PAID] and a field [BQ JOINING FEE] with a default format of currency.
I created a macro to set the value of [BQ JOINING FEE] to 0 if ([DATE PAID]>[JOINED]+60). It sets the value to 0 as required but I am unable to get it to format the result as currency.
View 1 Replies
View Related
Jul 25, 2013
I have a piece of code that I'm using to display an image on a report based on a path saved to each record. the code is:
Code:
Option Compare Database
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.ImagePath) Then
Me.ImgPic.Picture = "O:BellinghamIntranetProductionLabelsNo Label.bmp"
Else
Me.ImgPic.Picture = Me.ImagePath
End If
End Sub
It seems like every few months the code crashes access and then never works again. When I debug, the part that is highlighted is:
Code:
Me.ImgPic.Picture = Me.ImagePath
The only way i've found to correct it is to delete the report and the module and copy them back in from a backup database. What could be causing this code to crash or how to stabalize my database to prevent this from happening again.
View 14 Replies
View Related
Jan 22, 2014
I have two unbound unlinked subforms residing on a 3rd unbound main form. When I enter the current record on Subform1 I would like the matching record(s) on Subform2 to be highlighted or otherwise formatted. I can get this to work for only the first record on subform2 due to the way I have my code setup on Subform1:
Code:
Private Sub Accounting_Unit_Enter()
'find where AUs match. only works for first Subform2 record
If Me.[Accounting Unit] = Forms!MainForm.[Subform2]!AccountingUnit Then
msgbox "Match"
End If
End Sub
My thought was that I needed to reference the Recordset of Subform2 and search for all AccountingUnits that match the current AccountingUnit of Subform1,
View 6 Replies
View Related
Mar 15, 2005
Hi,
I have been told that there used to be an option to record a macro in access '97 so that it would record your steps and then this can be saved as a macro and run when needed.
I need to be able to have relationships automatically added between three tables and thought the best way would be to use this record macro option. It doesnt seem to be part of Access now..
does any one know anything about this.. or how I could get Access to assign relationships to the tables automatically?
Thanks
-x-
View 1 Replies
View Related
Nov 8, 2007
I have a simple table of Customer names. It's as simple as two fields involved:
CustomerID
CustomerName
How can I use VBA code or macro to add a new record to this table? I'm a newbie, so if possible, please provide a few lines of example codes. Thanks.
View 6 Replies
View Related
Feb 23, 2008
Hi!
Is it possible to run a Macro each time the user changes the Record on the Form? If so how? :confused:
View 2 Replies
View Related
Dec 21, 2006
I really hate being stupid about this, but I'm running around in a circle and it's making me dizzy. All I want is a simple macro that opens a form (with a subform) at a new record from a button. I know I am missing something obvious so I will let others see if they can find out what has gone wrong. The current macro is:
OpenForm(FormName)..View(Form)..DataMode(Add)
GoToRecord .. ObjectType(Form) .. ObjectName(FormName) .. Record(New)
On the property sheet of the form the following are all set to yes:
Allow Filters, Allow Edits, Allow Deletions, Allow Additions, Data Entry (I suspect the problem is here)
Record Locks is set to No Locks.
When I open the form from the button, it looks right, and I can enter the transaction information, but when I try to enter the subform information or save it , I get "The Microsoft Jet database engine cannot find a record in the table 'NewContacts_tbl' with key matching field(s) 'ContactID'". I get the same message with Allow Data Entry set to no.
And yes the key field IS there, in spite of what the Microsoft Jet database says.
I hope everyone gets a chance to enjoy the holidays and thanks to all of you for your past help and my current (relative) sanity.
A2K
:(
View 3 Replies
View Related
Nov 8, 2004
I am trying to create a table of help messages and display them help in a form. Using MSAccess.
Each Form used will have a help button, that runs a macro "mcrHelp.xxxxx". This macro should select the relevant record from the table to display in the "Help Form".
But i am having problems selecting the records.
Ex.
Macro name: mcrHelp.Help1
Table name: tblHelp
Fields: HelpId HelpTitle Description1 Description2
Data: 1 Help1 Sentence 1 Sentence 2
Form to display help in: frmHelpScreen
I want mcrHelp.Help1 to select the Help1 record from tblHelp and display Sentence 1 and Sentence 2 in the form frmHelpScreen.
Each time i try the macro i have i get the first record displayed in the form.
Many thanks
View 1 Replies
View Related
Nov 1, 2006
I am basically setting up a macro that will change the value for a field from "N" to "Y" for all records from a query. The macro works fine except for it does not know when to stop and gives an error message of "You can't assign a value to this object" after it has gone through all of the records and there are none left to change. The macro is set up like this:
OpenForm Action : This form is populated by the query and I set the Where condition to open records that don't already have a value of "Y".
SetValue Action : I use this to set the value of the field to "Y"
Close Action : I use this to close the form and save the changes
RunMacro Action : This is where the problem is. I use this to repeat the macro so it can go through the rest of the records that still have the field set to "N". I need to set the Condition or Repeat Expression so that it checks if all of the records have been changed. It either needs to check that all records have the field = "Y" or check that the macro is on the last record. Basically something that will cause the macro to not open itself again when there are no more records to be changed.
View 2 Replies
View Related
Jan 30, 2013
Self tought in Access07 but I'm trying to do the following:
I've got a form (Clients_F) that has a subform in datasheet view with a list of quote numbers made by each customer, I have managed to make a Macro after a few hours and googling, that opens another form (Quotes_F) so that it can be edited when a quote number is clicked, but I wish to be able to open Quotes_F as a new record when the empty field under the numbers column in the list is clicked.
Also want to know if it's possible to mantain the Customer's details pre-filled?...I am guessing that this is done through the CustomerID(PK & FK)?
View 9 Replies
View Related
Dec 4, 2012
I have a macro that opens up a form called SLA Complete Form - The macro then goes and examines two fields on the form to see if they contain data and if they do not then it displays a popup box with a message.
The form that gets opened up can have anywhere from one record to approximately a hundred records.
How can I get the macro to stop running when it hits the last record on the form without displaying an error message. I am currently using the next record feature in the macro.
View 1 Replies
View Related
Dec 6, 2012
I used the Control Wizard to create a macro on a command button to do record navigation i.e. go to First, Next, Previous and last record. The macro code, in the macro editor, is inserted on a command button on the form, asks whether it is a table, query form etc. I chose form and entered the form name but the error says the form needs to be open before I can run the macro. This happens when I open the form from a Navigation Control and Click the button containing the Macro code on the form.
View 1 Replies
View Related
Apr 14, 2014
I have created a button with Macro located on form in record. It does what I want except I want it to display only last record. Currently it is displays first record and I have to scroll. See attached photo of what I have. Access 2010
View 2 Replies
View Related
Dec 8, 2014
I'm very new to access database and I'm trying to create a macro that allows the user to enter data after seeing a mistake in a form. I need a macro that will open the specific table and record of a piece of data. For example there is a student TestName3 whose grade on a competency is 30% but should really be 45%. I want a macro by the competency percentage to allow the teacher to edit that without looking through the entire table. The macro should prompt first to ask if the teacher is sure they would like to edit, second prompt asking for the student's unique ID number, and finally be taken to the specific record and table related to that competency.
I have tried to use a vastly overcomplicated DLookup and Order column to give me the value for a acGoTo search.
Here's what I have.
Option Compare Database
Dim answer As String
Dim response As Object
Dim gotoresponse As Object
Private Sub Command71_Click()
On Error GoTo Command71_Click_Err
[Code] ......
View 5 Replies
View Related
Oct 15, 2013
Is there anyway to reset a query or macro when you open a new record? My database seems to be holding on to data from the previous record. The data is gained from two queries and one macro.
View 1 Replies
View Related
Jun 18, 2015
I have a form that has a Combo box record selector which works fine. I need to add more to the Where condition of this macro.
Combo1 - Options 1-Facility, 2-Physician (referral_type)
Combo2 - Record selector that works, either shows a list of facilities or list of physicians.
Macro SearchForRecord - Where Condition ="[fac_id] = " & Str(Nz([Screen].[ActiveControl].[Column](0),0))
Would like it to be
="[fac_id] = " & Str(Nz([Screen].[ActiveControl].[Column](0),0)) AND [referral_type] = Me!Combo2
Have tried a few different things with no luck.
View 5 Replies
View Related
Aug 9, 2012
I have a macro that needs to run repeatedly until the number of records in a query =0 but I can't seem to get the Repeat Expression set properly.
My query is called sqMatchCount:
SELECT Count(sqCompare_Parts_Matched_1st.BRP_Entry_Num) AS MatchCount
FROM sqCompare_Parts_Matched_1st;
The theory is if I don't have any more matches then I do not want the macro to run any more. In other words, MatchCount will = 0 when there are no more matches.
I have tried a variety of syntax using DCount in the Repeat Expression:
=DCount("*","sqMatchCount") ...... Macro runs in a continuous loop
DCount("*","sqMatchCount")=0 ...... Macro does not run (although I thought a couple times it actually DID run with this syntax)
DCount("MatchCount","sqMatchCount")=0 ...... Macro does not run
=DCount("MatchCount","sqMatchCount")=0 ....... Macro does not run
=DCount("MatchCount","sqMatchCount") ....... Macro runs in a continuous loop
What IS the proper way to write this Repeat Expression for the RunMacro Action if I want it to run as long as sqMatchCount.MatchCount>0?
View 14 Replies
View Related
May 1, 2012
I have a parent form showing some of the contents of a single record in a parent table. This form contains a button that opens a specific subform (using an IF statement based on the contents of another field in the parent table/form. There are actually any of 8 child forms/tables that could be selected and the related record is in only one of them. The relation between the tables is based on the PK of the parent table and the related FK in the child table. and the data is correct in all tables.
My problem is that when I run this button on the parent form/table it returns the appropriate form/table, but displays the first record rather than the related record. In the past (using this same process) I have been successful in getting to the right record by fiddling with the where statement (sometimes putting in a equal sign or taking it out fixes the problem). However, no matter what I do to the Where statement nothing works. I have not yet placed the final else condition for where the form selection field (VMValIdentType] is empty yet as there is no point at this time.
Here are the button macro contents:
If [VMValIdentType] = "Software"
OpenForm
Form Name: tmpVMValSW
View: Form
Filter Name:
[code]...
View 7 Replies
View Related
Dec 8, 2013
I am trying to write a more complex macro that will start another macro at a preset time, however I am getting stopped at the first hurdle - getting a macro to run another macro.
Here is the code i am using at the moment, all I want to do currently is click the first button, then get the second macro to execute. But no luck, getting error 2157 "cannot find the procedure"
Code:
Private Sub Command3_Click()
MsgBox "1st macro running", vbExclamation, "Note"
Application.Run "teststart1"
' Application.OnTime TimeValue("19:55:00"), "teststart1"
[code]....
View 1 Replies
View Related