Creating Form To Target Current Record Open In Another Form
Apr 17, 2014
I have three objects a Main_Table , ClientDataForm and a MapForm all three share a common ClientID number
From that Main_Table I have created a ClientDataForm form which I enter all Data
From ClientDataForm I wish to create a button on it which runs a Macro that Saves ClientDataForm Record and then populates another form named MapForm with whatever record is currently open in Form One whether a newly created one or previous record.
How would I write this code for that button? Also why I would write it that way?
I have a main form "frmDriverNoticeRecord" with 2 subforms, "frmSubDriverNotice" and "frmSubVehicleRecord"..The main form uses "IncidentID" as the PK. Each form stores data in its own table. The tables are related via IncidentID and there is a 1-many relationship between tblIncident (main) and tblDN (sub) and tblVehicle (sub).
I have a form "frmIncidentLog" displaying records in a table view with a few fields for quick reference and to allow selection of a single record for detailed viewing. I created a command button with the intent to open the "frmDriverNoticeRecord" at the current record. The main form and child link fields appear to be linked correctly; i.e. IncidentID on all three. If I open the form manually it opens and I can use it and search and filter as I want. If I try to open it via the command button It opens a small window asking for the IncidenID, when I enter theIncidentID number, it opens the form to the first record every time.Here is the code:
Private Sub comOpenDR_Click()
Dim frmName As String Dim recID As String frmName = "frmDriverNoticeRecord" recID = "[IncidentID]=" & Me![IncidentID] DoCmd.OpenForm frmName, , , recID End Sub
I tried running the the DoCmd.OpenForm command directly from the button using the where condition (in various manners) with the same results.
But what I need is that before printing, open the preview to set the margins and page size ... or at least to pre-configure so that when you press the button, and comes preformatted.
I have a form that lists records in a table. I would like to have a hyperlink beside each record that will open the data entry form and navigate to that specific record. Right now, the use can only open the form for all records and has to use the record navigation buttons to find the desired record.
When I have a form called "SiteForm" open and click a button "NewCalloutButton" I would like it to open up a form called "CalloutFormEntry"
I've done this using
Private Sub cmdOpenDetail_Click() DoCmd.OpenForm "CalloutFormEntry", , , "CalloutID = " & Me!CalloutID End Sub
However this brings up all the records linked to the calloutID
What I'm after is to open the CalloutFormEntry from the SiteForm in a dataentry kind of format but to carry over the current SiteID based on which site is open on the SiteForm. That way there's no user error logging callouts to incorrect sites.
I have a fault form which the user enters details of a fault. When the fault form is submitted the data is saved in the relevant table and the form is cleared so that the user can enter the next fault. On the fault form i have a subform which displays the faults previously entered by the user. I want the user to be able to click on an entry in the subform and open the orignal fault form and see the data that had been entered. How can i create this functionality??
I am trying to resolve an issue of being able to use a query from many different forms where the query is dependent on the date selected in the current open form. Right now it calls the function getDate() which works fine. Unfortunatly the function is called before the form is fully loaded and the control I want to pass has no value/doesn't exist yet and I get a "Runtime error 13 Type-Mismatch"
Here is the function code:
Function getDate() As String
If fIsLoaded("F_SupplierData") Then getDate = Form_F_SupplierData.txtDate Else getDate = "01/01/1901" End If
End Function
Function fIsLoaded(ByVal strFormName As String) As Integer 'Returns a 0 if form is not open or a -1 if Open If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then If Forms(strFormName).CurrentView <> 0 Then fIsLoaded = True End If End If End Function
Is there a way to detect the state of the text field itself (if it is open, closed, dirty)? Or if anyone has a better way to tie a query to multiple forms?
I've researched all the email topics, but can't find what I am trying to do. Most of these topics are talking about emailing a record or form or something.
I have a form that contains thousands of contacts address, telephone, email, etc. I would like to create a button that on click would open Outlook and grab ONLY the email of the current contact I am looking at on the form at that time and add that email address to the [To:] box of a new email.
Thanks you guys, I'm learning...slowly, but it's coming.
I have two forms. In form 1, there is a combo box that I have set on click to open form 2 in this manner:
Code: Private Sub boxEditEntry_Click() DoCmd.OpenForm "frmSRTEdit", , , "[ControlNumber]=" & Me.boxEditEntry End Sub
The thing is, this has only worked when Form 2 is already open. I can't figure out why. If Form 2 is not open or has not been opened, the on click will still open Form 2, but not to the value in the combo box, or any value for that matter, it's blank. I really need it open if has not yet been opened or if it has been closed before. Also, I'm fairly new to access and I have no clue what I'm doing in vb.
I have a continuous form in which I put a command button for each record called "detail". I would like to click on the "detail" button and make it open another form containing all (and only) the info on this record.
At first I refused to use an "id" to link both forms, but finally I added the "id" in the table... however still does not work.
continuous form: "04 - GASTOS_BUSQUEDA" id field on continuous form: "Gastid"
pop-up (details) form: "GASTOS_EDITAR" id on pop-up (details) form: "editar_id"
This is what I have tried on the "click" properties of the "details" button field (called "btn_editgs"):
4) Private Sub btn_editgs_Click() On Error GoTo btn_editgs_Click_Err Dim strWhere As String strWhere = "[editar_id] = " & Me.Gastid DoCmd.OpenForm "GASTOS_EDITAR", , , strWhere btn_editgs_Click_Exit: Exit Sub btn_editgs_Click_Err: MsgBox Error$ Resume btn_editgs_Click_Exit End Sub
I am trying to create a proposal log for my company to make things easier to track. I have made a multiple items form to list the proposals. I want to be able to double click the record to open up another form (that i have already created) that shows the information from the proposal table and the proposal details table. So.....
I want to double click the field named "Proposal Name" and have it open up to form i have called "proposals details form".
I have a main form[frmResearchNotes] with combo box controls that filters a query populating [subfrmNotelist] containing several records from the filtered query. From there, I double click on a field within one of the remaining records, [CompanyName] for example, and it opens the new form[frmNoteDetail]. The problem is that second form is not displaying that selected record. The second form's record source has been set to the same query so when it loads, it displays the same info but it's displaying the 1st record out of the entire filtered list, not the record I clicked on in that list.
I figured I could use the strWhere function to copy the record I selected in the event procedure and then open the new form with those details. Not sure how to actually do this with VBA or if it's even the correct approach.
I have code for a button click event. Essentially I have a main table form that I use to enter customer data and info. I also have a button that I use to add that customer to a separate table that I use for special Customers. My code copies all the data I need copied to my other table, so I wont waste space here typing my code that actually copies the data to the new table. What I will list are the two commands I am using after that code, to close the current form (the one with the button) and open the form for entering special customer information (the form to edit data on my other table). It works flawlessly, but when it opens the other form, it opens to the first record. I want to know how to make it open to the record which I was viewing when I clicked the button to copy the data.
DoCmd.OpenForm "Special Customer Data Entry", , , Number = Me.Number DoCmd.Close acForm, "Customer Data"
table 2 (form2) Reference (fK) workbook reference (PK) auto number
Table 3 (sub form within in form2) Reference (FK) workbook reference (fK) data Reference (pk) auto number
Each table is a form that is linked via the keys. On form 1 i have a button that is to open the form2, which it does but every time i open the form a new record is added. Why and how do i prevent this.
Then what i want to do is add a button for a new form on table 2 form but use the same reference as the record as presently displayed. How do i add new record using the same Reference but new workbook Reference?
The first form is called "entry" the second for is called "play"
I am trying to open the play form on the click of a button so that it displays the records matching the value set for the [playid] field in both forms.
I have a table called tblFinishedGoods. There are 3 fields in the table:Serial Number, Model Number and Location.
I would like to have a form that will take input from my barcode reader and input the data for the 3 fields, if the serial number is not already in the table.(I have this already working). But now I would like the same form to also check the table for any serial number that is scanned in...and if it is in the table already, have it bring up the model number and location for that record.
I'm thinking maybe there is something I can do with Serial Number afterupdate. Basically I'm looking for a way to not require the user to input anything via a mouse or keyboard.
If the 1 form could accept the 3 scans:Serial Number,Model Number and Location, and either 1)enter a new record if that serial number isnt in the table or 2)find that the serial number already exists and overwrite the model number and location with whatever the next 2 scans are.
I have a form in access that opens to the first record every time. This form will be constantly updated and i was wondering how i can set it, so that it opens up to a new record everytime you open the form.
I would like to create the following functionality on a form in my database:
When the form is open, and a record is displayed on the screen, I want to add a button that will open up a second form displaying information related to that record.
To be specific, I have a form called "Contracts". Each contract record contains a customer name in the field "Customers." I want to create a button labeled "Customer Details" that will open a new form, "ViewCustomers" displaying the record associated with the value entered in the "Customers" field for the current (displayed) record only.
I have been trying to use a hyperlink to a macro that uses "OpenForm," form name "ViewCustomers," but I don't know how to filter it down to just the current record.
I hope any of this makes sense. Any insight would be really helpful.
on a form with several subforms i have ran into some trouble. I have the subforms use code to determine if a scrollbar is needed. As a recordselector I use a listbox on the main form.
When i close the mainform, it sometimes makes a popup box appear saying that there is no current record.
Sofar I have determined the following :
- Removing the code from the form, removes the error.
- The code is only executed when selected records in the listbox have related record(s)
- The error only occurs when the code is executed at least once and the last selected record has no related record(s)
I dont know if altering the code would have any success, cause it won't run anyway when I select the last record (with no related records).
I guess moving the code to another section would be better, but I've tried other options like 'on focus' etc, but could not find one that responded.
HELP PLZ :)
Private Sub Form_Current() On Error GoTo Error
'kijken of verticale scrollbar nodig is maxRegels = 14
Dim rstCount As DAO.Recordset Set rstCount = Me.Recordset If rstCount.RecordCount > maxRegels Then Me.Form.ScrollBars = 2 Else Me.Form.ScrollBars = 0 End If
Error: If Err.Number <> "0" Then Else MsgBox Err.Number & " " & Err.Description End If Exit Sub
End Sub
ps. I've tried to catch err.Number = "3021" in the Error: section, but without success
I'm really new at this Access database, but I've managed to create a database, tables, forms, macros, report and a switchboard, most of which work. Printing the current form command button works great.
I really need to email the current form or record, but can't seem to figure it out. I can email the report using the snapshot format, which is what I'm after, but it includes every record. If I email the form, the format has to be chosen and it doesn't look like the report.
Can someone help me with this? Thanks so much, Jolene
What I'm trying to do is automate the process of adding a selected person to a particular case. What I'm thinking is that frmCases (which includes subfrmPeoplePerCase) will include a button to add a person to the case. Once clicked, frmSearchPeople would open. Once a person is selected and frmPeople displays their information, a button would then be displayed/enabled on frmPeople to add them to the current case in frmCases. Once this button is clicked, it would display a message box asking to confirm if PersonID should be added to CaseID. If confirmed, the information is then appended to tblPeoplePerCase (which includes PersonID, CaseID). The user is then brought back to frmCases and the subfrmPeoplePerCase displays the newly related information.
I am having trouble getting the ID of the current record displayed on a form. The code I have written is this:
Code: Dim ProjID As Long ProjID = Forms![ProjectDetailsAll].CurrentRecord
The problem is that this code returns the record number relative to other records (so, this record is number 2634 of 2634). However, I am trying to get the ID of the record, which is an autonumber and is not the same as the record's order amongst other records. There have been record deletions ahead of this record, so the ID might be 3096 even though CurrentRecord tells me that this record is number 2634. Is there another way of writing this to get what I need?
I would like to have the form to be set to its current record when being requeried. How can I easily achieve this? I've seen things about recordsets, I'm working with ADP (based on SQL Server) and don't know or all DAO events will help me.
is there an easy way to copy the current record on a form when clicking a command button such that a snapshot of that record is copied to a table for archiving purposes?
the table has about 120 columns so it is cumbersome to write an Insert Into sql statement within VBA code.
what i am attempting should be quite straightforward...i just want to take the current record in its entirety that is from a single table and append it to another table of the same structure.
I currently am trying to print the current record that I have selected on my form and the subform that I have on the same page. If I try to print selected record it will only print out the main form correctly and will print out the first record on the sub form. I have tried to make a reprot of the current form and it only will do the main form and nothing from the sub form. I am willing to try whatever method would work in getting this to work. Thanks