DoCmd.Save - Form And Subform
Oct 7, 2006
Hi all,
I have a form (Record Source = Report_TBL). I've brought in a subform (Record Source = Patient_TBL). I linked the 2 on the field PID.
I've added a command button (Submit).
OnClick for the Submit button I've added in the Event Procedure
Private Sub cmdSubmit_Click()
DoCmd.Save
End Sub
It only saves the data I've put in for the subform.
Can anyone give me any information on how to save all the information from both forms?
Thank you so much for your help!
Jill
View Replies
ADVERTISEMENT
Apr 22, 2014
i have a form with subform in it, and when i press the save button in the main form it saves only the records in it but it wont save the records in the subform
i found on microsoft this code
DoCmd.Save acForm, "New Employees Form"
how can i use it to save both the main form and subform together
View 3 Replies
View Related
Oct 11, 2013
I have created a form with subform on it having one to many relation .
I have created a save button on main form and edited the before update property of main form to require the click on save button to update the record.
But when i enter the fields on form and click inside subform to enter child values , all the main form data is removed automatically .
What am I doing wrong i just wanted to save only when user clicks the save button. (see the image attached)
View 6 Replies
View Related
Jun 21, 2005
I have a main form and a sub form. Tbhidden and tbpropersave are the text boxes that govern the update procedure. The main form has two text box that i use to prevent the user from modifying the information on the main form without clicking my custom save button. the problem is that the subform should be completed after the information on the main form has been filled in. The Update code i have refuses to allow me to complete the subform without first clicking the save button on the main form. Here is the code. I wana be able to fill in info in the main form, then the sub form then click save. The sub form is a table which relates to the main form table Many to One.
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_Form_BeforeUpdate
Me.tbhidden.SetFocus
If Me.tbPropersave.Value = "No" Then
Beep
MsgBox "Please Save This Record!" & vbCrLf & vbLf & "You can not advance to another record until you either 'Save' the changes made to this record or 'Undo' your changes.", vbExclamation, "Save Required"
DoCmd.CancelEvent
Exit Sub
End If
Exit_Form_BeforeUpdate:
Exit Sub
Err_Form_BeforeUpdate:
If Err = 3020 Then 'Update or CancelUpdate without AddNew or Edit
Exit Sub
Else
MsgBox Err.Number, Err.Description
Resume Exit_Form_BeforeUpdate
End If
Please HELP
End Sub
View 1 Replies
View Related
Dec 4, 2014
How can I make certain my user enters records on a subform before attempting to save the main form? Right now they can completely ignore the subform before saving the record.The Main form has business address, etc. on it. the subform is bound to a join table that lists the multiple categories, subcategories and sector the business is listed in for a directory.
I already have my fields set to required at the table level in the join table, and have some existing VBA in both my subform (to update edited date) and my form (to validate empty records where a certain condition is met) but that's not the issue...
How do I focus the user to enter a record on the subform to the point where they are forced to enter something and complete the subform before the record is updated.
View 2 Replies
View Related
May 24, 2014
I have a form and a subform in it. I added New cancel button in the form so that the the user can cancel the record creation and no record will be inserted in the parent table.
But when details are entered in the subform (a datasheet) row records will be created in the subform table. what is the correct method or how to cancel these records if the user choose to click cancel button on the parent form.
View 5 Replies
View Related
Mar 26, 2005
I have a form which contains one subform. On the subform I have a command button which saves the record just entered. On the main form I have a "refresh form data" button which updates the main form so that the calculated controls can show the correct results based on the data just entered?
Can anyone tell me how I can get the "save record" button in the subform to subsequently refresh the data in the main form as well, thus saving a button???
Many thanks.
Peter
View 8 Replies
View Related
Dec 20, 2005
Hi,
OK my main form is unbound and I have a subform in it which is shown as a datasheet. What I'm trying to do is have a list box control at the top that allows the user to filter the records shown in the subform.
Q1. Do I need to have this set-up like this? Is it possible to just use one form? I have tried doing this but when I add my list box, lables etc to the top of the form or the header they just do not appear in datasheet view.
Q2. If I do need to use a subform how do I reference it when using DoCmd.ApplyFilter from my main form:
DoCmd.ApplyFilter , "DrawingNum = '32-35612'"
At the moment this gives an error saying that the action or method is invalid because the form is unbound.
Thanks for your time,
RCurtin
View 3 Replies
View Related
May 26, 2015
I have a bound form that normally is opened via macro. Very straight forward just has the following in the where.
Code:
[userID]=[Forms]![Home]![txtSelectUser]
I'm trying to open the same form via doCmd.
Code:
DoCmd.OpenForm "frmUserInformation", , , "UserID=" & Me.txtProblemID
I've msgbox'd the txtProblemID and the correct ID is being passed. Where I fall into an error is on the frmUserInformation's onLoad event which uses the ID form the frmUserInformation.txtUserID box. The error I get is "Syntax error (missing operator in query expression '[fldUserID]='."
Code:
strEndMonth = DLookup("fldDateExpiration", "qryUserExpirationDate", "[fldUserID]=" & Me.txtUserID)
What I've narrowed it to is the timing between the docmd.openform and the onload of the form. I've tried changing the onload to be on activate - and it just opens empty.
how to get the docmd to open the form correctly before the onload tries to fire?
View 6 Replies
View Related
Nov 22, 2011
Sendkeys "^s" - Ctrl-S to save the app isn't working.I need to get access to save layout changes made by a user to a subform.I have a subform and some controls on the main form that alter the layout of the subform - some checkboxes that hide and unhide the columns.I also have a button that exports the current contents of the subform to excel.
DoCmd.OutputTo acOutputForm, "MySubForm", acFormatXLS, OutputPath, AutoStart:=-1 (Very happy with how this works!)
The problem is that if the user hides or unhides columns using my checkboxes, these changes are not picked up by the export to Excel until the user saves the subform by closing the form.So I need some code that forces changes made to the subform to be saved, without closing the subform.
DoCmd.Save acForm, "MySubForm" - doesn't work "RunTime Error 2489 - The object isn't open."
What DOES work is clicking the save button in the top left corner of the access application.Sendkeys "^s" for some reason doesn't do anything at all. Code that mimics the main SAVE button in access, or code that will specifically force my subform to save layout changes as it would when closing?
View 1 Replies
View Related
Aug 28, 2005
Hi everybody, i am an U Student from Singapore.and i am a new MS ACCESS learner. So please kindly advice me a question about MS ACCESS.
I created one form called MonthlyTransaction. Inside this Form, i have another sub-form called Forecast. So my question is how do i save the MonthlyTransaction data into monthlyTransaction table and Forecast data into Forecast table? But the field name in Forecast table called MonthlyTransID is the value of MonthlyTransID in the MonthlyTransaction table.
Thanks very very much in advanced for yours help.
Regards.
Wilmos Lee.
View 2 Replies
View Related
Jul 1, 2013
1. I have a Main form (based on a table) with a Subform.
2. The Subform is based on a Query
I want to save the data from the Subform (Salary Field) to my Table, I dont know if VBA will be the best option.
TABLE FIELDS:
ID*
EMPLOYEE_NOS
NAME
SALARY
MAIN FORM FIELDS:
ID*
EMPLOYEE_NOS
NAME
SUBFORM FIELDS:
EMPLOYEE_NOS
SALARY
View 2 Replies
View Related
Jul 2, 2013
I have a MainTable with Subform. The Subform is based on a Query. I want to save the data/Fields from subform to my TempTable..
MainTable Fields:
EmployeeNo
Name
Position
TempTable Fields:
ID*
Salary
Allowance
Subform Fields:
EmployeeNO (not Shown on Query results)
Salary
Allowance
I want the fields in my subform to be saved in TempTable..
View 4 Replies
View Related
Oct 20, 2014
What I'm trying to do: I have created an unbound field within a subform's footer to calculate the average of the displayed record values. The subform is in datasheet view. The records are returned based on a query with a relationship between two tables. I need the calculated data (which I currently have displayed on the main form) to populate within the master table.
I can't figure out how to automatically do this. I created a simple command to get it there, but I'd like the user not to need a button to display a calculation.
Main form based on TableA; subform based on TableB.
Here's how I have it set up (Btw, I suck at SQL I just figure this is easiest to read):
Query SQL looks like this: SELECT tblB.Field1, tblB.Field2 FROM tblB.Field1 INNER JOIN tblA ON tblB.Field1 = tblA.Field1
Main form: unbound txtbox = [Forms]![frmA]![subfrmA].Form.[txtAvg]
The field that is averaged is tblB.Field2. There are potentially a bunch of records displayed in the subform.
I need that [txtAvg] field to save to TableA. My command button is simply Me.tblA.FieldName = Me.unboundtxtbox. I'd like to do away with that.
I tried to use the on current or on load event for the main form; but the calculated field value is 0 until it calculates it. It seems like there is a short delay before the value shows up on the form at which point the on current or on load events don't pick up the calculated value; just the 0 that is initially there.
View 5 Replies
View Related
Apr 13, 2015
I Have a main form called table one has 3 fields an autonumber as primary key and i have a subform called table 2 has 3 fields one an autonumber a primary key , second is an integer which is equal to table 1 primary key, and third is a text with default value set to N/A
i want when the user enter info in the main form and save it, the subform automatially add new record and save it with default settings..so far what s happening , that the related field in the subform to the main, is getting change but record is not getting save in the table 2
View 4 Replies
View Related
Nov 21, 2014
I have a form with multiple textboxes and comboboxes that allow for user entry, and a subform displaying a table, where the entries from the form are saved and can be retrieved. It's basically a way of creating new task entries and editing existing ones from a single interface.
One of the fields is an "issue number" of sorts, which is a 5-digit code that identifies the task. We have a website where details of each task are stored, and the URL format is akin to this: [URL] ....
The functionality that I'm hoping for is that when the user saves the record, it will be saved as the full link address, by concatenating the static first portion of the address and the code entered by the user. However, I need the table to still only display the code, not the whole link address, and will follow the full address when clicked in the subform table.
View 2 Replies
View Related
Nov 5, 2014
I am adding new record into subform via recordsetclone method. The problem is that record is added but on save it does not appear in the table. If add this record manual using subform everything works. When record added manually update of the record works fine.
C
'Add Wastage value to flooring area section
Private Sub Wastage_AfterUpdate()
Dim rsFlArea As DAO.Recordset
Dim Wastage As Double
Dim Item As String
Set rsFlArea = Me.OrderFloorAreaEdit.Form.RecordsetClone
[Code] .....
View 6 Replies
View Related
Feb 12, 2014
So I have this relatively simple problem: I need to create a button that once clicked will open the Save As dialog box and allow the user to save a copy of the current database where he wishes. The filename should contain todays date in DDMM format along with some pre-set text e.g. DDMM PresetText.
I am using Access 2010.
View 2 Replies
View Related
Jan 10, 2014
I have a few selected reports on an Access 2007 database that users can run. Is there a way for users to view the report, save as a PDF and automatically save a copy to a shared drive by modules/vba coding as an On Click event procedure?
View 4 Replies
View Related
Jul 30, 2013
I have a main form and subform. The main form is bound to a table of invoices and the subform to a table of invoice items. I'm picking up the invoice number from the form to save it to the invoice items table, so I need to save the record for the invoice before saving the invoice items from the subform.
View 4 Replies
View Related
Aug 26, 2014
I have a split form that's like a list of pending tasks. The data source is a linked SharePoint 2013 list where users submit requests. The user takes the information from each record and performs an action. When it is done, the user presses a button and the task status changes from "Pending" to "Processed". The form record source is based on a query that finds only records with a status of "Pending" so when the user changes the status of the task, it is removed from the list. It works fine except when there is only one task left in the work list. If the user processes the last task, the form refreshes and it goes to a new empty record and I get an error message that says I must enter a value into one of the required fields. I tried making the field non-required but it just creates an empty record in the table.
View 3 Replies
View Related
Nov 30, 2005
Why won't the form save - it's telling me the command or action Save Record isn't available just now. I've got it on a After Update event of a combo box where it saves the record then it previews a report. If I don't save before opening the report half the data is missing.
If Me.Dirty Then
If MsgBox("Record has not been saved. " & Chr(13) & _
"Do you want to save it?", vbInformation + vbOKCancel) = vbOK Then
DoCmd.RunCommand acCmdSaveRecord
Else
Exit Sub
End If
End If
View 8 Replies
View Related
Sep 7, 2006
have searched on above but could not find anything
I want to start another database from within a database from a command button
Use the wizard option for RunApp and it appeared to work okay. definately pointing at the database.
Event procedure is
Private Sub Command39_Click()
On Error GoTo Err_Command39_Click
Dim stAppName As String
stAppName = "msaccess.exe C:LenWorking DatabaseSingle Non Conformance SystemDatabaseSecure Defect Docket Database.mdb"
Call Shell(stAppName, 1)
Exit_Command39_Click:
Exit Sub
Err_Command39_Click:
MsgBox Err.Description
Resume Exit_Command39_Click
End Sub
Getting error saying that I was trying to use an option in command line that was not recognised.
Few clicks on the OK and the error message cannot find file
Any clues please
len
View 6 Replies
View Related
Feb 1, 2005
I have aproblem with the range of this thing. I think I have a wrong synthax or something.
I need to have the first 120 records of columns A and D
The first two lines aren't records but titles
So I had:
DoCmd.TransferSpreadsheet acLink, acSpreadsheetTypeExcel8, "ExcelTEMP", mijnFile, False, "A3:A122;D3:D122"
Access tels me there is somthing wrong with the range, though it works in Excel :confused:
View 3 Replies
View Related
Jul 27, 2006
I've the following SQL query in my database:
DoCmd.RunSQL "INSERT INTO tblPlanner ( RACF, [Date], [Day Capacity], [Role Title], TimeWork ) SELECT tblStaff.RACF, [txtday1] AS Expr1, tblStaff.[Daily Capability], tblStaff.[Role Title], tblStaff.[Contract mins] FROM tblStaff WHERE (((tblStaff.TeamName) Like [txtTeamName])) WITH OWNERACCESS OPTION;"
The problem is everytime it runs it informe that the query will change data in the table. What can I do to stop it?
Thanks
View 3 Replies
View Related
Oct 29, 2004
I am trying to develop a page where users can click on alphabets to look for a company name that starts with the selected letter.
Searching through the forums i came across the method of using DoCmd.
alpha = Request.QueryString("alp")
if alpha <> "" then
DoCmd.ApplyFilter "", "[com_name] Like ""[" & alpha & "]*"""
end if
The 'alpha' variable here holds the alphabet selected by user from another page. However, I'm getting an error message saying
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'DoCmd'
Initially i tried the usual filtering
if alpha <> "" then
rs.Filter = "com_name LIKE " & alpha
end if
The pages are suppose to display records in 10s. But instead of showing only the records of company starting "A" (example) it shows everything.
Please kindly point me to the correct direction to solve this problem.
Thank you so much.
-meiyeen-
View 2 Replies
View Related