Modules & VBA :: Opening A Form To A Specific Record
Nov 21, 2013
I have a table that has two forms linked to it - one is the Main Form which is used to input the data for the bulk of entries, however on some entries there will be some additional data required which the other form (lets call it Time Form) takes care of.
What I would like to do is have a button on the Main Form that opens the Time Form, and then go to the specific record that is open on the Main Form;I have an ID field (Autonumber + Primary Key) which displays in a text box on the main form, and it would provide the number of the record for the second form to open.
I've initiated a log on procedure, with a password.
A user enters their ID and password. Once the correct password is entered, the next form is then loaded up, to which they make some choices.
My problem is that I have lots of users, and I would like them to only access the page that is relevant to themse, and NOT be able to see anyone elses.
I gather there is a little bit of tweaking to go on the docmd.openform...
line, and somehow incorporate the userID, but not entirely too sure what it is.
I have a Calibration form, with a button on it that links to an Equipment Inventory form. In the Calibration form, you choose the instrument you want to calibrate from a combo box (which in turn automatically selects the barcode number for the instrument in another combo box), then if you need to edit info on it (ie. serial number), you click the button
Now, I need the Equipment Inventory form to open to the record that matches the bar code in the second combo box
I've done this dozen's of time - but it doesn't seem to be working now. I have a continuous form (frmHome) where i want a user to be able to click on a record, and be able to open up that specific record in "frmCustomer". The key field here is pkCustomerID (i have it in the query).
I have a form that displays details for a specific asset and a continuous subform that lists all the purchases for that asset. I have the following code in the On Click event for one of the fields in the subform:
Dim myOrder As Integer myOrder = Me.txtOrder DoCmd.OpenForm "frmOrders", acNormal, , "OrderID=" & Order, acFormEdit, , "Edit"
The problem is, when I click on any item in the subform, the code returns the value of the first item in the form rather than the one clicked on. If I open the subform on its own (outside the main form) then the code works fine. I can't figure out why it won't work in a subform.
I have a form "frm_PatientNew" based on table "tbl_patients", this form contains a button "cmd_NewVisit" which is supposed to do the following: opens the form "frm_NewVisit" for recording a new visit for the last recorded patient in "tbl_Patients", I found many approaches depending on DMax and Dlookup and they worked fine just if "frm_NewVisit" is bound to "tbl_Patients", but "frm_NewVisit" is bound to "tbl_Main" which acts as a container for all information (patient data, visit data,service done and service provider), so the form "frm_NewVisit" contains fields from different tables. I wonder if I should create "frm_NewVisit" as unbound form, then adding fields from different tables to it and using vba to populate "tbl_Main",
I have a form that displays customer account information. The form is connected to two tables. each customer has their own account number that i use to lookup their information. right now i have to click on the account number field and click find to pull up the record. I have built a popup form that displays the customers names with their respcetive accounts. My question is, How can i use the popup form to select a customer name and have the main form goto that record without using the find button.
I have created a database with a switchboard and a form ("RMA"). Currently, on my "RMA" form I have a command button that allows the user to find a specific record by entering an RMA number into an input box. My code is as follows:
Private Sub cmdFindRMA_Click() Dim myFilter as String If vFindRMA = "" Then 'vFindRMA is a global variable, string. vFindRMA = InputBox ("Enter the RMA Number to find:", "Find RMA", "", 5000, 3000) myFilter = "[RMA_Number]='" & vFindRMA & "'" Me.Filter = myFilter If Me.Filter = "" Then Me.FilterOn = False Else Me.FilterOn = True End If End If vFindRMA = "" End Sub
I want to be able to remove this command button from my RMA form and add it to my Switchboard. My problem is, I don't know what code I need to use in order for it to work from the switchboard. Can anyone help?
But it returns every record for that agent and I want to be able to specify the date that goes with the name.
For example Tom has a record for Feb 10, Jan 10, and Dec 13. I only want to see the record for Dec 13.
I am able to see this in my form by having a combo box for the agent and the date (the date box being based on the agent box). So now how can I add a condition to include the date combo box?
Adding the condition gives me and type mismatch error, which I think may come down to the date combo box on the form having 3 columns (only 1 is visible).
I have a form that is opened as hidden when my startup form loads. Data gets entered into it from other forms so whenever I switch records the hidden form needs to be opened to the matching record.
To accomplish this, I have been using the DoCmd.OpenForm in the OnCurrent event with the WHERE clause matching the PK/FK. I have had no luck with the SearchFor method.
It seems silly to have to keep reopening a form to go to a specific record when the form is always open already. Plus, I am wondering if it is affecting the forms' load times.
I was wondering if there is a code for Next and Previous record in a form but for a specific value.
Example: I have a customer that has a specific ID and that customer has a list of orders that all contain that ID. When I open a form for orders I would like to be able by using Next and Previous record buttons to be able that was to move only through records of that customer not the whole list of orders for every customer.
How to do an UPDATE using VBA on a form to update a specific record on the table using an unbound field on the form to filter the update.
Every time the code runs, it tells me: Run-time error '3144': Syntax error in UPDATE statement and takes me to the "CurrentDb.Execute strSQL, dbFailOnError" line at the end of my sample below.
Hello, i have managed to get my form button to open another form to a specific record but this doesnt always work, i have used to wizard in access to do it some times it works other nots.
could any body help at all. i believe it could be a problem with my relationships. i have deleted them al to start again, but i am having trouble setting them up!
I know this has to be an easy fix but I can't find it. I would like to open my form with empty fields, in the first field, ready to go. Right now it is opening with the first field of the very first record. Please help
hello, i have an .mdb file, with one main form in it. i want to send to some friends of mine this file, but i want that when the file is opened, automatically, that main form will be opened. how can i do that?
I have a master form for lack of a better phrase and 3 other forms that represent specific items in the original drop down box. In the master drop down box, I have all 50 states, and the 3 forms are for 3 specific states. Here's the code I have so far but when I save, it says "The 'OpenForm' macro action has an invalid value for the 'Where Condition' agrument."
Option Compare Database Option Explicit Private Sub State_AfterUpdate() Select Case Me.State Case "CA" DoCmd.OpenForm "Auditor Form (CA)"
I have 4 forms in my access file. Now I have 4 buttons in html and I wanted to know if there was a way to open a specific form view based on the button click in the html page.
So access will open and show the form that is linked to the selected button in html.
I want to hyperlink from a query direct to the relevant record in a specific form. I have a hyperlink field in the form which shows up in the query. When clicked in the query, this hyperlinks to the form but I cannot make it select the correct record in the form.How do I get it to select the correct record?
I created a search form that searches for Customer Number, Part Number, and Revision Number. The results are displayed in a List Box.
I want the user to be able to make a selection on the List Box and click an "Open Selected" button that launches that record in another form. How is this possible?
Is it possible to use VBA or macros to open a table to a specific record?
I know how to open a table in database view using a command button. I'd like to have it open to or automatically scroll to and select a specific record, based on the content of the form. This way I don't have to spend time scrolling through the whole table to try and find the desired record.
My form used to work and as I kept adding event scripts now when I click on the ID text field, it doesn't open the linked record, but a blank record with 'Filtered' showing on the bottom navigation. I guess a question I have is,
-is there an order on which the procedure scripts run -do they all run everytime, or just the specific event script
=================================== Private Sub Company_Click() DoCmd.OpenForm "frm Company", , , "[ID] = " & [ID] DoCmd.Close acForm, "frmCompanyDirectory" End Sub ===================================
I used to have code on a button on the "frmCompanyDirectory" that added a new record to "frm Company" and that's when the ID = ID stopped working.