Modules & VBA :: Open Form To Record / Where Text Box Matches Value Of Text Box On Another Form
Aug 16, 2014
I am trying to make use of the OpenForm command to open a form to a record where a textbox matches the value of a text box on another form.
On Form1, I have a textbox called txtRtnRef, and it contains a reference number in a similar format to SWR-9
On Form2, I have a textbox called txtReOrderRef (control source ReOrderRef) which also contains a reference number in the same format (SWR-9)
I am trying to have a button next to the text box on Form1 that has an OnClick Event that opens Form2 to the record containing the same text reference number.I have tried, to no avail, a number of variations of the OpenForm command, the most recent being
Code:
DoCmd.OpenForm "Form2", , , "ReOrderRef = '" & Me.txtRtnRef & "'"
The form opens, but to a blank record?
View Replies
ADVERTISEMENT
Oct 29, 2013
I have some code for a button on click event to open a form and select the record which corresponds to a value in an unbound text box. The code is:
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmOpenPatientRecord"
[Code] ....
This works fine when I put in a 10 digit NHS number but opens a blank record when I enter a four digit or six character/digit PatientNumber. Both patient number and NHS number are text fields in the underlying table.
View 14 Replies
View Related
May 27, 2015
We have an access database which has a form that has a list box that details particular records. See attach "list box".
What I would like to do is double click on the record and this would look in a powerpoint folder (see attach "path") and open the presentation if there is a match to the value in Listbox Column 5 i.e. Tool Number.
I can get it to open the presentation if I include the tool number in the path but I cannot seem to be able to get it to compare the values and only open if there is a match.
View 4 Replies
View Related
Jun 6, 2013
I have one table containing name of restaurant with its address etc. Then i created another table to list out the restaurant workers names and details. Just as an example,
Table:Restaurant
Restaurant name
Address line 1
Address line 2
Restaurant #
Website
Table:StaffContact
Staff Role
Name
speciality
email
phone
I have the main form that has all the restaurant details only. And i have another form containing the Staff information. Please note the two table have a relation and it works well.
Now to make it user friendly(basically easier for the lazy ones), I dragged the staff contact form on to my main form and displayed it as a datasheet(basically a sub form).
Now, my boss does not want users to add/delete on this sub form(datasheet). So,he wants me to create buttons to open new record of staff for each restaurant(new form)
My issue is with opening a new record to enter a new person to the staff list and give them a role as well in form view.The new form has
So i ran a Macro, with open form with Where condition
Code:
[Staffcontact]![Rest Name]=[Forms]![MainForm]![RestaurantName]
But, it does not work .
View 2 Replies
View Related
Apr 27, 2005
I currently have two forms: frmE_SAFind and frmE_SAOrder
frmE_SAFind shows results from a query including fields [txtIDPO] and [dtmDate]
Example:
IDPO Date
btnOpnFrm 6543 2/1/05
btnOpnFrm 5681 1/1/05
frmE_SAOrder shows order details including [txtIDPO] and [dtmDate]
I have a open form command button set up on [frmE_SAFind] that opens [frmE_SAOrder]. Is it possible for me to modify its properties so that when the open form command button is clicked, the order details in [frmE_SAOrder] will represent the order that the user is selecting via the btnOpnFrm command?
Example: If I click btnOpnFrm for 6543, [frmE_SAOrder] will show me PO 6543 details.
Hopefully I made myself clear enough to understand. Thanks for your help!
View 1 Replies
View Related
Mar 30, 2013
A charity has a client file (over 700 clients) that will have records that need editing. The user is presented with a form(1) holding a text box to enter the parameter (Client Surname) for a query. They can use starting letters and wildcards to narrow a search e.g. Jo*The click a command button that opens another form(2) based on a query that uses the parameters from the first form.
This Works just as planed if matches are found. If not, it displays a blank/new record. I want to either 1) stop the blank form being displayed 2) tell the user that their query was unsuccessful. I Do not want them to use this facility to CREATE a NEW Client record.
The parameter query is working fine and form(2) shows the matching records, it's reacting to a situation where no records are found, that is my problem.
View 2 Replies
View Related
Aug 29, 2012
When loading a form often some of the text is missing, headers are not there and/or the colours for the background are simple white, until I either resize the form or scroll up and down a few times.
View 1 Replies
View Related
May 7, 2014
How do I get a certain column of a query result pasted to a text box when I open the form?
View 2 Replies
View Related
Dec 18, 2014
I am in the process of (attempting) to develop a database and application for Parking & Violation Management. I have two tables at this point: "Parking Registration" and "Violations" that are linked by a "Permit #". I have developed a form that will allow the officer to enter either the "Permit" or the "Licence Plate" of a vehicle to run a "Vehicle Check" query to produce specific information for the vehicle in question; which is what I wanted, kind of... The problem is that the resulting data pops up in "table" format, and contains multiple fields, making review of the data difficult due to its lengthy, linear nature. Is there a way to have those results appear in text boxes either on a separate form or the "Vehicle Check" form itself?
View 1 Replies
View Related
May 16, 2014
What I'm trying to accomplish is some sort of 'Order Confirmation' (filled with the info i have entered in my order form and sub_form fields) that i can copy and paste as a reply to their email-order.
I have taken 2 failed approaches so far:
1) I used a report to display the info
Private Sub Command103_Click()
DoCmd.OpenReport "Order Confirmed", acViewReport, , "OrderID = " & Me!OrderID
End Sub
This worked fine until the information was copied and pasted into outlook which upon doing so changed the column titles and layout
2) I used another form with a text box to fill with the data entered on the Order form
DoCmd.OpenForm "frm_Order_Confirmation"
[Forms]![frm_Order_Confirmation]![txtConfirmation_Text] = "Ref.:" & " " & [txtCustomer_Order_Reference_Number] & [vbNewLine] & "Item No.:" & " " & [cboProductID].[Column](1)
I got stuck here when trying to reference the data in the sub form... Also each order can have one or more colours and how to allow for this?
View 2 Replies
View Related
Oct 10, 2013
I have a table that holds the SQL texts for ca. 1000 Select queries (mostly minor variants that are used to programmatically swap out RowSource strings for combo boxes). I'd like to have a quick and easy way to open/review/modify these queries.
One strategy would be to display the SQL strings in a field on a Datasheet form, then use an onClick event on a text box linked to the SQL-holding field (or perhaps an onClick event tied to an unbound text box on the form) to open the associated query. That would allow me to view the SQL of the query that I want to open, allow me to quickly scroll through the list of stored SQL texts, and give me options for sorting or limiting the SQL-texts displayed in the datasheet form.
But, I can't seem to get the onClick event to work. The problem seems to be that I can't figure out how to pass the SQL string contained in the field to a function that will use that string to open the query .
View 10 Replies
View Related
Jul 10, 2013
I am trying to open a word document with corresponding data filled from the text field of a form. I managed to get the word document but I don't know how to give a variable in word document.
View 2 Replies
View Related
May 6, 2015
I have a BE database, that when opened, opens a form for saving the results of a query to a text file on the desktop. It works fine, if the full path is entered.
The problem is, I want this saved on any users' desktop. I did some digging and found the %userprofile% variable, which when used, gives me the error.
I understand this should work in both Windows XP and Windows 7, which are the environments the full DB will operate in. So far the "EXPORT" button on the form has the following for the code:
Code:
Private Sub BTN_Export_Click()
DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", "C:UsersMark N. McAllisterDesktopPubComExp.txt"
End Sub
When I tried this:
Code:
Private Sub BTN_Export_Click()
Dim strPath As String
strPath ="%userprofile%desktopPubComExp.txt"
DoCmd.TransferText acExportDelim, , "QRY_ExportPublicComment", strPath
End Sub
the error occurs.
View 10 Replies
View Related
Aug 2, 2015
I am using an apply filter in a form to find records in a split form.
The macro which I am using is:
[SLIDE] Like "*" & [Forms]![SALES]![ENTERREFDATA] & "*"
However I the filter to return only records which match the text exactly.
View 2 Replies
View Related
Mar 27, 2014
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.
Is there a better way to do this (there must be)?
View 1 Replies
View Related
Jan 6, 2014
My database has Main form and a Sub form. On main form i place one unbound text box named investigations. In subform of which datasheet there is a column named TestCode. I want unbound text box (Investigations) to display row values which selected in a column (TestCode) of subform.for example:Investigation field should display "CBC,HB,ALP".
View 5 Replies
View Related
Jun 23, 2015
I am using Access 2007 and 2010. I would like a text box (or label) on a report to autofil using fixed text from a label on a different (closed) form.
View 8 Replies
View Related
Jul 12, 2013
I have a Form Display Data in my Access Database, which is working really well. However, users was asking if there is a way we can make Font Color Could/would change if The text in A field or Any field in my display form contained the word "SAD or MAD". Is there code for such thing in display form?..
View 3 Replies
View Related
Dec 17, 2013
In my Access adp, when I open a certain form (frmVertebrates), the databinding occurs in the Load event for the form, for various reasons. I have not specified any datasource in the form's design view.
Databinding for frmVertebrates:
Code:
Me.Form.RecordSource = "select * from dbo.vertebrates where catalogID=3"
This works great when just opening the form. However, when opening with a filter from a button on another form it won't work, the form displays all records.
Button code:
DoCmd.OpenForm frmVertebrates, , , "vertID=123"
Obviously, this makes sense, since the record source is explicitly set in the Load event.
Is there a way to capture the filter "vertID=123" so it can be added to the Form.RecordSource sql?
When breaking in the Load-code and watching the 'form' variable, I can't spot the filter condition anywhere...
View 4 Replies
View Related
May 7, 2014
What I need to do is press a button on a form. When the button is pressed, I want to create a new record in a table not already open and populate some fields with data from the form I am looking at. Then call up a new form with the record I just created on it.
Basically it is a work-order entry issue, the user scrolls through to find the correct piece of equipment when they do they click on "Create work-order" a work order is created and populated and the user can then fine tune the new work-order as required.
View 13 Replies
View Related
Sep 4, 2014
I am using a datasheet view with dbl click code to open a form to a selected record. I was able to use pbaldy's code and it worked perfectly.
DoCmd.OpenForm "Asset Status", , , "[Project Number] = '" & Me.Project_Number & " ' "
Then I realized I really want to be able to go to other records after I have gone to this form and tried this:
Dim rs As Object
Dim lngBookmark As Long
'set variable to the current record
lngBookmark = Me.Project_Number
'open new form
[code]....
But to no avail. Project_Number is a text field.
View 12 Replies
View Related
Apr 15, 2015
i've been working on a sample database today that someone has written some vb code into, which enables the database to merge with some dialler software. basically it's just a hang up and dial button on a form for surveying people.
i've done ok extracting the code for the dial and hangup buttons, referencing the external file and getting my test database to interface with the dialler but it currently allows multiple users to edit the same record, which i need to stop it doing.
the guy that's done the coding says he's more of a vb programmer and not much use in access (he's definitely better than me!) but i should be able to insert some code that will skip to the next record if the record is being worked on with someone else.
i think the piece of code that i need is
Forms("Form1").RecordLocks = 2
the only problem is i don't know what else to type with it or where in the code to insert it.
View 5 Replies
View Related
Nov 12, 2013
I am trying to search on EmployeeID field and populate corresponding data like EmployeeName, EmployeePay in other text boxes in the same box .
In my Unbound Form I have three unbound Text Boxes and one Command button:
txtEmpID
txtEmpName
txtEmpPay
cmdFind
In my table EMPLOYEE i have three fields
EmpID -- Autonumber
EmpName -- Text
EmpPay -- Text
View 2 Replies
View Related
Dec 21, 2012
I have a form where I want a textbox [txtMaxOrdLimit] to be visible only if another text box on the same form [PaNumber] contains the letter D in the string. This is the code I have on the forms On Current property but I'm missing something because textbox [txtMaxOrdLimit] doesn't show on the form at all.
If Me.PaNumber = "*D" Then
Me.txtMaxOrdLimit.Visible = True
Else
Me.txtMaxOrdLimit.Visible = False
End If
View 3 Replies
View Related
Jun 4, 2015
I'm trying to continue with my rebuild of our call answering screen. It's basically a form with a button for each company we represent, clicking the button will lead to a call answering screen for the company. we also have software that pops the correct screen when we receive a call for the corresponding company.
I'm trying to get some of the fields to autopopulate, starting with the telephone number of the caller. the number appears in a text box on the main form and I'm trying to copy it into the caller telephone box on the call answering form. I've got code in place but it gives me the error "you can't reference a property or method for a control unless the control has the focus". Here's the code for the form I'm working on...
Code:
Option Compare Database
Private Sub cmd_recordcomplete_Click()
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name
End Sub
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
txt_dateandtime.Value = Now
Me.txt_callertelephone.Text = Forms!Switchboard!txt_incoming.Text
End Sub
View 3 Replies
View Related
Dec 3, 2005
Hi,
As a part of reducing traffic on file server, I am planning to read less record on the form and hence I tried removing forms record source. (Attached sample db)
I kept all unbound textboxes onto the forms and save new record to the table using codes back of the command button. This is working great with main form. But doesn’t with sub form. I tried removing record source of sub form and keeping unbound text boxes to appear record if it exists.
If you enter 1 in InvNum text box on main form, you will find it brings record. I don’t want to show the record on the sub form unless I call it from main form.
How can I use the same trick of unbound text boxes with sub form too?
Please extend your help.
With kind regards,
Ashfaque
View 8 Replies
View Related