Forms :: Passing Field Value From One To Another Form That Creates A New Record
Mar 13, 2013
I have several different sub-forms that have a button that opens a new form which creates a new record. Each of the different sub-forms have a field value that needs to be passed to the new record when the other form is opened. I've tried a few solutions, but to no avail. Right now I'm using the macro functionality as follows for one of the subforms:
ACTION ARGUMENTS
--------------------------------
RunCommand SaveRecord
OpenForm frmDocumentNew, Form, , [AssociatedClientTracking]=[Forms]![sfrm_ClientTracking]![ID-ClientTracking], , Normal
OnError Next,
GoToRecord ,,New,
MsgBox =[MacroError].[Description], Yes, None,
SetProperty [AssociatedClientTracking], Enabled, Me.ID-ClientTracking
The problem I think is that I'm creating a new record so the value doesn't get passed. The new record is only created after the user begins to enter data in the new form that was opened.
View Replies
ADVERTISEMENT
Oct 8, 2014
I have a main form with several tabs. One of the tabs is a subform with just one number control, driven by a select query. The control shows a number, and you can type in a new number, which then updates the field in the table.
BUT, the control then shows a zero, it has moved to a blank record. If you enter a number again, it will attempt to write it to a new record.
So how do I display the number, and allow a new number to be entered that will update the SAME record, and not moved to a new record?
View 1 Replies
View Related
Jul 29, 2013
I have a form that uses a text box to search for a specific record in a table.(Cotton12) This works perfectly. What I would like to implement however is if the user so wishes he can edit the data he is shown, whithout editing the actual data in cotton12 and then with this new info create a new record in cotton13.
View 1 Replies
View Related
May 20, 2014
Have a form that contains fields AssociatedProject, AssociatedRelease and then the user hits a button to create a new record and a new form opens to display this newly created record which sets the fields and also sets a field called Type. There is no issue with setting the field values and the new record is created. However, when the form opens to display the record it displays another record instead (usually the one before it). I think it could be related to the fact that the db resides on a shared drive which periodically has slow connectivity. However, I'm looking for a solution, perhaps modifying the code?
Here's the code:
Private Sub Command17_Click()
Dim strSQL As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim ctl As Control
Dim varItem As Variant
On Error GoTo Err_Command17_Click
Set db = CurrentDb()
Set rs = db.OpenRecordset("Tbl_Main", dbOpenDynaset, dbAppendOnly)
[code]....
View 6 Replies
View Related
Jan 24, 2006
Hi,
I have a form with a number of fields and buttons on it. The form is opened in "add new record" mode. I have noticed that when I move from the last field in the tab order to the first field in the tab order it saves an entry in the database.
This is causing me problems because when users move from the last field in the tab order to the field in the tab order an entry is saved to the database but it by passes all the data checks ensuring that certain fields have been filled-in etc.
I don't know why the movement between these two fields is causing an entry to be saved. I don't have code associated with either of these objects. I aslo changed the last field in the tab order to a different field and it still happens.
Any ideas or suggestions would be greatly appreciated.
View 2 Replies
View Related
Dec 28, 2014
I created a basic database in Access 2013 to keep up with jobs, and each job has a job number assigned to make each job unique (Primary Key).
At first I had it where I had to enter the new job number manually for each job. I have updated it and now it takes the last job number and adds 1 to it and then fills in the Job Number field automatically.
The problem is when I clicked the Last Record button, it will go to the last existing record, but if I click the Next Record button while on the last record, it will create a new record. It creates a new job instead of stopping at the last record. I assume it has to do with the auto numbering I have setup for the job numbers, since it didn't do this before, but I am not sure why. I ONLY want to be able to click the New Record (Blank) button to create a new job, NOT by also clicking the Next Record button.
Is there a way to force only the New Record button to add a new record? I still need the Previous and Next Record buttons to maneuver through the existing records. I just don't want to create new jobs accidentally by clicking the Next Record button when I'm at the end of the existing records. It should just stop, or say last record or something similar.
View 3 Replies
View Related
Oct 25, 2013
Have one form that contains values AssociatedProject and AssociatedRelease that need to be passed onto another form that opens with a new record. Have tried different variations based on what I read here and couldn't get them to work.
Initial form - frm_ViewList contains the values that I need to pass on and has a "Add" button to bring up the new form that also creates a new record. The add button contains the following:
Dim stDocName As String
MyAssociatedProject = Me.AssociatedProject
MyAssociatedRelease = Me.AssociatedRelease
stDocName = "Frm:ManageQuestionsAnswersProc"
DoCmd.OpenForm stDocName, acNormal
DoCmd.GoToRecord , , acNewRec
Then in the second form Frm:ManageQuestionsAnswersProc the following code is contained in the Before Insert:
Me.AssociatedProject = MyAssociatedProject
Me.AssociatedRelease = MyAssociatedRelease
View 3 Replies
View Related
May 28, 2015
I have "LossForm" to record loss of inventory items due to damage, theft, etc. It has "Loss Subform" for input of multiple items. The row has a calculated field "TotalLoss" (from qty * itemcost). The footer of subform has unbound text field =Sum(nz([TotalLoss])). This all works fine. The problem I have is that I need to pass the total to another form. I want to have a pop-up form to use some of the field values from the Loss form. I have been able to pass all of the field values except for the TotalLoss.
LossForm Close Event: "DoCmd.OpenForm "Journal", , , , acFormAdd, , Me.LossID & ";" & Me.LossDate
pop up form:
Set frmPrevious = Screen.ActiveForm
Me.TransactionID = frmPrevious.LossID
Me.EntryType = "Loss"
Me.Date = frmPrevious.LossDate
{ Me.Amount = frmPrevious.TotalLoss doesn't work }
DoCmd.Save
End Sub
I also tried to setup a global, class, and module variable but keep getting error message of undefined variable.
View 2 Replies
View Related
Sep 8, 2013
I have a form set to the table Client Information with a subform set to the table Event Information. Client Information has a one to many relationship to Event Information.
There is a button that deletes the current record in Client Information--also deleting the related records in Event Information--then closes the form. The code works fine but a blank record in Event Information is apparently being created before the form closes.
Here's the VBA that I'm using:
Private Sub CmdDelReturn_Click()
Dim CmdDelReturnMsg As String
CmdDelReturnMsg = MsgBox("Delete event & client then return to front?", vbYesNo + vbDefaultButton1, "Delete and Return?")
[Code] ....
It's not a big deal because the button won't be used often and I can manually go into the table to delete the blank record. But if there's a simple solution to prevent this that would be nice.
View 3 Replies
View Related
Jul 31, 2015
When I launch my modal, I want the user to be able to 'cancel' without creating a new record. It's not doing that and creating extra 'junk' in my table. How do I prevent that?
Here's my code:
Private Sub Btn_Exception_SubModal_Click()
DoCmd.OpenForm "Frm_Exception_UpdateModal", acNormal, , acFormAdd
Forms! [Frm_Exception_UpdateModal]![clientnmbr].value = Me![clientnmbr].value
End Sub
View 6 Replies
View Related
Jan 12, 2007
I have a form that has a main for, a subform, and then another subform inside the 1st subform. The form works like this:
Conact info
--->Call info and notes
---> Orders worked
Each of those being nested as they appear. The problem is, the user usually jumps strait to putting the order number in "Orders worked" before entering in any notes or info... So no record exists in it's parent form to tie to. How can I have the database create a new record in its parent form when the user types in the subform?
Thanks!
View 1 Replies
View Related
Jun 24, 2014
I am using an on-click event on my form to call up a report for the current record. It has been a while since I've used the form to call the report, but I always remember it working correctly. Today when I try to call up the report, it opens but no record is being pulled up so the report pulls up blank.
Code:
DoCmd.OpenReport "rptSupplierInformation", acViewPreview, , "[OperationID]=" & [cboMoveTo], acWindowNormal
View 1 Replies
View Related
Jan 15, 2014
After I enter data into one field in a record I would like the form to save the record when I move to another field in the same record. It seems that the record is only saved when I exit it entirely. Is there a way to save a record when moving between fields in that record? Can this be done without using an Event Procedure for each field?
View 8 Replies
View Related
Mar 11, 2014
I have a query which contains figures. i have a search form based on this query and need to search using comparison operators such as <10000 or >500.
Is there a way to pass these value to criteria field in query ?
View 14 Replies
View Related
Jul 22, 2015
I have a form and in the subform for that I have a button that opens a pop up form. I want to pass the value [ACB ID] to an unbound text box in the popup form but I am having trouble. My code for the button in the subform is:
DoCmd.OpenForm "addPartNumberMod", acNormal, , "ACB = " & Me.[ACB ID], WindowMode:=acDialog
Currently when I press the button it asks me to enter the acb value instead of carrying it over. Also, when i do type in a number into the dialog, when the form opens, the text box is blank.
View 4 Replies
View Related
Apr 17, 2014
I have a form where I would like to validate (restrict) choices in subsequent fields.
Example
Combobox choices are Air, Fire, Water, Earth, Space
In the form I have 4 fields = Material1, Material2, Material3, Material4. (all in same record on my table)
Basically I need the validation to not allow duplicates across the 4 fields.
something like....
[Material1] <> [Material2] or [Material3]or [Material4]
I am not sure of the proper syntax for the validation field in the Form Properties. Or if I am even putting it in the right place.
View 3 Replies
View Related
Aug 27, 2014
What is the best way to move from the last field on the last page of a form to a new record field on the first page?
View 5 Replies
View Related
Mar 31, 2015
Anyway, I have a form that opens in datasheet view. It displays company names that exist on a client table based on a "Like" criteria the user typed into a text box. They type the word "network" in the text box, click search and a datasheet opens that has all companies that have "network" somewhere in the title. That's it. Works perfectly. We'll call this datasheet view form result "Test Query Form."
I have a second form that currently allows users to select a company from a drop down box and then populates the rest of the form with data from a table for that company. Again, works perfectly. We'll call this form "Existing Info."
I want to make a change to this second form. Rather than allow a drop down combo box for selection of the company, I want the "Test Query Form" to open the "Existing Info" form and automatically populate the form based on the company that the user double clicks on in the "Test Query Form." For instance, if I type in "network" and clicked search and got three companies with the word "network" in the company name, I want the user to double click on the second company name and have the "Existing Info" form open up with that second company on it and all the info populated for that second company.
I know this needs to be VBA code on the dblClick command for the company name cell on the "Test Query Form" but I can't quite get it to push the company name through to the "Existing Info" form.
View 3 Replies
View Related
Oct 19, 2013
How do I pass back a value to the calling form (i.e. 'FormA') from a form that is called (i.e. 'FormB').
'FormB' code
stFormName = "FormB"
DoCmd.OpenForm stFormName, acNormal, , , , acWindowNormal, strValue
Msgbox strValue (This is the returned value
'FormB' code
strValue = 'This is the passing value'
View 4 Replies
View Related
May 2, 2015
Private Sub CardName_AfterUpdate()
Me.Purchasing = Me.CardName.Column(2)
Me.Selling = Me.CardName.Column(3)
End Sub
I get value of Column(2) in Purchasing textbox but in Selling textbox not why?
View 14 Replies
View Related
Jul 5, 2013
I have a search form that searches for student ID from the student demographics table. I have it set when I click on the student ID (Frm_Student_Demographics_DailyCares) it will open the student visit form. When the student visit form opens it will show the student ID on the Student Visit Form but it is not being recorded in the student visit table.
I have Student ID control source on the Student Visit Form set as:
=[Forms]![frm_SearchStudent_DailyCares]![Frm_Student_Demographics_DailyCares].[Form].[SD_Record_ID].[Value]
My tables are called Student Demographics(parent table) and Student Daily Cares(child table) and they are linked by Student ID.
I have done this before on another part of this database but I just simply can't seem to find what I missed.
Here is a sample of my forms and tables.
View 2 Replies
View Related
Aug 26, 2014
I have a Form 01 that has staff names and the primary key StaffID. From this form, I want to open Form 02 to add a new record linked by the StaffID. How do I automatically populate the PK (StaffID) in Form 01 as the FK (StaffID) in Form 02?
View 1 Replies
View Related
Apr 12, 2013
I have the date set in the table and it shows up fine in the tblDate cell but doesn't pass through to the txttblDate in the form. I did have it working just fine until I rebuilt my database.
View 14 Replies
View Related
Aug 29, 2013
I have a form that uses Table A as a record source and has a subform that uses Table B as a record source. There is a one to many relationship between Table A (one) and Table B (many).The user opens the form to a set record, then uses the subform to create a new record in Table B.
This works perfectly and I can do everything I want. But sometimes the subform creates a blank entry in Table B before I enter any data. Then, once I start entering data, it creates another record in which it stores the data that I am entering.The result is two records: One that only has the date of the record's creation (I set that to be automatic upon creating a new record) and the primary key that links Table B to Table A. A second one is the "true" record, the one which stores all of the data that I am entering.
It won't happen for 10 records or something and there is no apparent pattern. In case it makes a difference, the form is set to open as the subform as the focus.
View 14 Replies
View Related
Jan 30, 2014
I have a database of experimental products. The database allows test technicians to input test information as well as product information (obviously in separate tables). Therefore before a tech logs test information, they have to first make sure the test product is in the database. They can do this by looking up the products that are in the database, and if the current one isn't they can input its information. In the lookup section you can also click on an individual product and lookup its test history.
What I am looking to do is add a button in the product information screen that allows the tech to open the test information input form with the test product information already loaded into the form. The product information portion of the test input form, is two combo boxes, one indicates the test products group and the other is the product number.
Looking up information on Google looks like i might need to use the OpenArgs function, however I have never used that before.
View 3 Replies
View Related
Aug 15, 2006
I have a form that uses the following join as its control source:SELECT * FROM [Purchase Order]
LEFT JOIN [Work Orders]
ON [Purchase Order].WorkOrderID = [Work Orders].WorkOrderID;
I also enclosed a small picture of the relationship between the two tables. This is the problem I'm getting when using my purchase order form.
What I Want:
When I type in the "Work Order #" it will lookup the most recent work order with the same number and put its ID into the purchase order record.
What I'm Getting:
When I type in the "Work Order #" a brand new work order is created and the "Work Order ID" field gets the next number in the sequence.
Make note that I'm not using code for any of this. This is happening all on its own. I think the join is messing things up here. Any ideas?
View 2 Replies
View Related