Modules & VBA :: Unbound Textbox To Display Memo Field Based On Listbox Record Selection

Apr 21, 2014

My table:

tblHeatTreatment
- HeatTreatmentID - PK
- HeatTreatmentDesc - Text
- HeatTreatmentDetails - Memo

My form has a listbox (lstHeatTreatments - Multi-Select disabled) that displays Heat Treatment descriptions and an unbound textbox (txtHTDetails) that I would like to have display the corresponding memo field when a description is selected from the listbox.

This is my code so far:

Code:
Private Sub lstHeatTreatments_AfterUpdate()
Dim myConnection As ADODB.Connection
Dim myRecordSet As New ADODB.Recordset
Dim mySQL As String
Dim selectedRequirementKey As Long
Set myConnection = CurrentProject.AccessConnection
Set myRecordSet.ActiveConnection = myConnection

[Code]....

When I run the code I get an error:

Quote:

Run-time error '-2147352567 (80020009)':

The Value you entered isn't valid for this field

When I debug, it highlights:

Code:

Me.txtHTDetails = myRecordSet.Fields

View Replies


ADVERTISEMENT

Modules & VBA :: Populating A Table Based On ListBox Selection

May 27, 2014

I have a form with a Listbox which lists Customers and a variety of customer information

I also have a table on the form that lists the donations that customers have made.

How can I populate the Table based on the customer that is selected in the Listbox?

There is an ID field that links Customers with Donations

I'm guessing I need some code in the ListBox_CLick() event that triggers the table to query or to Load with a query based on the ListBox.Column(0) which contains the ID?

View 2 Replies View Related

Modules & VBA :: Changing Combobox Text Based On Listbox Selection

Jul 26, 2013

I have a listbox with several options.

When the user selects one of these items, i want a combo box's text to be changed to the selected item in the list box.

The listbox is named : D_OutputLsb
The combobox is named : D_ComponentNameCmb

View 4 Replies View Related

Query Display Value From Calculated, Unbound Textbox

Oct 5, 2007

Here's the situation.

I have a calculated value in an unbound textbox (avghcppmw). I want to run a query (qinsphistory) in which one of the fields is the value of the textbox (avghcppmw).

Is there any way to pull the value from the form and display it in the query. I'm assuming not.

I also assume the only way to do this would be to create a query that would calculate the textbox value and base (qinsphistory) on the newly made query.

Is this correct?

View 6 Replies View Related

Modules & VBA :: Insert CR / LF In Memo Field Based On Search String

Jan 16, 2014

I import a CSV field which has not preserved the CR/LF when it was exported from BCM Remedy. There is no setting for that. The memo field prints on my report like this:

A custom solution would be developed, that once implemented, could become the standard product in similar situation. Normally would assign to Network Engineering, but will work with Ray and the IPT Team to cost out the solution and get approval to proceed. 2012/05/24 10:44:28 AM PCOLLINS Sent to Ray Massie for review to determine if a solution needs to be proposed, or if they can wait for the National IPT solution to be ready in 2013.

I want to add VBA code that inserts a CR/LF in the memo field before all but the first occurance of a string that looks like a date, the first occurance doesn't need it. I will do it right after I import the CSV file into the table, so it happens only once, and it always prints and displays the CR/LF.

The memo field is called "NBS Update" and the table is called "CCRR Remedy Data"Here is what I have, but don't actually know what to put in to find the date and add a CR/LF:

Code:
Dim db As DAO.Database

Code:
Dim db As DAO.Recordset
Dim srtSQL As String

[code]...

View 14 Replies View Related

Display Fields After Listbox Selection

Oct 22, 2014

I have been working on this problem for 3 days, and can't figure out what to do. I'm using Access 2010.

I have two tables. Tier1 and Tier2.

Table: Tier1 has Tier1ID (autonumber) and Tier1Desc

Table: Tier2 has
-Tier2id (autonumber)
-Tier1ID (which is the link back to the Tier1 table),
-Tier2Num -- this number shows which tier2 records are associated with each other
- and about 6 fields with descriptive info, 2 of which are memo fields

I have a form that has 2 listboxes:

- Listbox 1 has the row source to Tier1 table, control source Tier1ID
- Listbox 2 is an unbound listbox with the row source to a query.

The query is all the fields from Tier2 with the criteria where Tier1ID in Tier2 table = Tier1ID in Tier1 table

This all works. When I select something from the Tier1 ListBox, it displays the associated tier2 items for the tier1 selection.

What I need : When the selection is made in the 2nd listbox, I need the other 6 fields in tier2 table to be displayed based on the "Tier2Num". The listbox does return Tier2Num correctly.

I just need to display all the rest of the fields.

- I tried a popup form based on a query, but can't seem to pass the tier2Num to a form. (The query works if you enter the Tier2Num, which is the
[listitem] selection)
- I tried dlookup in a textbox
- I tried to add all the fields into the listbox, but could only get 3 to display (then I was going to do textboxes with the control(#) in it.

View 7 Replies View Related

Modules & VBA :: Only One Record Yes And Others Revert To No Based On User Selection

Jan 12, 2015

My table has a yes/no field and about 10 records. I have created a form for the user to select which of the records he wishes to use - the records are displayed in a continuous form with a check box for the yes/no field. The user is to select one record by checking the check box in the record.

I know this should be obvious, but I can't see it. How can I make it so the user can only select one of the records (when he clicks on one, that one is yes and the others revert to no?

View 4 Replies View Related

Forms :: Unbound Textbox Print Preview - Display New Value On Each Page?

Sep 6, 2013

I am working on a change control database where the users can enter a new version for the software they just released and send out a notification to the appropriate persons. I have a form where the user can select a combobox to pick the software version, which is bound to my "Releases" table. From the software version I use a DLookup in VBA to change the value of a another unbound text box using:

Me.Release_Type = DLookup("[Release_Type_ID_FK]", "Releases", "Release_ID_PK = " & Me.Release_ID)

This all works fine when I'm entering data in the form, but if I want to print the form, the unbound text box on each page is only calculated from the first record. The same thing happens if I build a report with the same fields and code.

For example: In print preview the text box on page 1 should say "Cat" based on the current record and the text box on page 2 should say "Dog". However, they both say "Cat"

How do I get the text box to display the new value on each page?

View 4 Replies View Related

Forms :: Display Definite Title For The Form In Unbound Textbox

Jan 19, 2015

I need to open form1 from form2 and display in unbound textbox a definite title for the form.

According to the title i want to hide some fields and unhide others.

View 5 Replies View Related

Modules & VBA :: New Record Button With Prefilled Number Based On Selection On Another Table

Jan 6, 2015

I'm making a database that so I can log calibration information about equipment every year.I have 2 tables:

The Equipment details table
The Calibration record table

ID Number is shared between the 2 tables so a calibration record can be linked to its' details.

For Example (simplified sample data):

Equipment Table
ID Item Unit Type
104 Thermometer DegC PT100

Calibration Table
ID Cal Point 1 Test Equipment Unit Under Test Date
104 20 21 22 06/01/15

What I want is a button on a form that creates a new blank record in my Calibration record table with the ID number already entered based on what record I selected in a combo box linked to my equipment table. I really don't know where to start.

View 2 Replies View Related

Textbox Based On Combo Selection

Jan 19, 2006

I choose a ‘Year’ from a combo box. Why doesn’t the data in my textbox update? (It’s a count of records for that year)

View 2 Replies View Related

General :: Create Chart Based On Unbound Textbox

Mar 5, 2014

I try to develop an access 2010 Forms that contains 1 or 2 charts. So my problem is, in my form I have 1 combobox and 5 unbound textbox. Inside Event OnChange combobox, there is function DCount that will setup value to the 5 unbound textbox. Until this point, the 5 unbound textbox is have its value.

Now I would like to create a chart that value are based on the 5 unbound text. How can i accomplish this ? i see in many articles, a chart row source is link to a cross tab query.

View 4 Replies View Related

Open New Form Based On Listbox Selection

Oct 25, 2005

I have a form which has a listbox listing all the letters a student has had sent home. Basically i want to be able to click on a letter in the list box and for a popup form to open with the record details. However it just brings up a blank record.

The list box has a unique field called standardletterID.

the code behind the button to filter was just used through the wizard to open the popup form is:

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmstandardletterspopup"

stLinkCriteria = "[StandardLetterID]=" & Me![List0]
DoCmd.OpenForm stDocName, , , stLinkCriteria

but it doesnt seem to be working :(

I thought this would be easy but no matter how much i destroy my database trying to do it its not playing ball!

View 1 Replies View Related

Forms :: Listbox Selection Based On A Table

Jul 18, 2014

I have a form with a listbox that allowed multiselection.

The listbox depends on the field "name"

And I have a table "names_should_be_selected" (fields: name, date ...)

It would be great if alle names in the listbox are selected when the name is in the table "names_should_be_selected".

View 3 Replies View Related

Forms :: Running A Query Based Upon A Listbox Selection?

May 1, 2015

I have a list box that is correctly listing resources from a table (tblResource). I would like to select one of the list box entry and run a query against the tblResource to show the information for that resource in a form. I have tried to use the lstindex with the control (lstResource) in the where clause of a query to accomplish this with no success.

View 5 Replies View Related

Modules & VBA :: Display Image On A Report Based On Path Saved To Each Record

Jul 25, 2013

I have a piece of code that I'm using to display an image on a report based on a path saved to each record. the code is:

Code:
Option Compare Database
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.ImagePath) Then
Me.ImgPic.Picture = "O:BellinghamIntranetProductionLabelsNo Label.bmp"
Else
Me.ImgPic.Picture = Me.ImagePath
End If
End Sub

It seems like every few months the code crashes access and then never works again. When I debug, the part that is highlighted is:

Code:
Me.ImgPic.Picture = Me.ImagePath

The only way i've found to correct it is to delete the report and the module and copy them back in from a backup database. What could be causing this code to crash or how to stabalize my database to prevent this from happening again.

View 14 Replies View Related

Forms :: How To Ensure That Textbox Value Displayed Is Based On Combobox Selection

Nov 4, 2014

I am designing a Web Database with a bound form to a submit table.

On the form, I have a combo box with selections that should influence the value to be displayed in a textbox also on same form.

For instance the combo box for Staff Name contains list of all Staff and I want the textbox to automatically display the level of the staff that was just selected in the combobox.

I know how to get this done using a combobox but my boss insists that the level should be automatically displayed in the textbox once combobox selection is done.

Using the combobox for level, I used the select statement in the RowSource property :

SELECT Staff_List.Level, Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Staff_Name)=[forms]![frmtest]![cboStaffName]));

I am in a dilemma of how to replicate this for the textbox because textbox only has control source and no RowSource where I can put this select statement.

Also, I will still need to bind this textbox to the submit table with the column name "TxtLevel" in the control source

Please see attached sample access db.

Also note that I cannot use action queries or VBA because it is a Web database and not a client database.

View 1 Replies View Related

Unbound Combo Box Selection To Load Record

Apr 5, 2005

First, just want to say I wish I had found this site a long time ago. Lots of good stuff here :) I don't know a lot about Access, but know it can be a great tool for what I need. So I hope I can find the help I am looking for...

Ok, on my form I have three unbound combobox's that I use to filter the information I want. The first two do not need to be used, meaning that the third combobox will show all the records if the first two are left blank.
With that being said...
I would like the form to show no data until the selection is made in this third combobox. SO, my first question is how do I make the form show no records till this combobox has a selection. And second (at the same time), make that third unbound combobox with the selection load that record to the form fields so they can be viewed or edited??

I'm sure it can be done, but I am lost...
Hope I explained it ok :)
Thanks in advance!!!!!!

View 1 Replies View Related

Display Subform Based On Selection

Mar 20, 2006

A tricky one this. Searched for answer but cannot find.

Acc 2003.

I have a main menu with 2 subforms.

In the on load event it sets the source object of the first subform, which displays a list of options (menu Style).

When choosing an option from SubForm1, I want SubForm2 to display the form I have coded in.

I currently have within subform 1 in the on click event the following.

Form_MainMenu.subform1.sourceobject = "formtodisplayinsubform2"

When running this from the main menu, nothing at all happens.

When opening just the subform 1 on it's own and clicking the option, it merely opens the main menu form.

Can anyone see what I am missing?

Thanks in advance

View 2 Replies View Related

Modules & VBA :: Update Specific Record In Table Using Unbound Field On Form

Dec 4, 2013

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.

Here's my code:

Dim strSQL As String
Dim strCriteria As String
strSQL = ""
strSQL = strSQL & " UPDATE [tblTicket] SET"
strSQL = strSQL & " ([UpdatedBy], [AssignedTo], [Requestor], [Dept])"
strSQL = strSQL & " Values"
strSQL = strSQL & " ('" & unbEnteredBy & "','" & cmbAssignedTo & "','" & cmbRequestor & "','" & cmbDepartment & "')"
strSQL = strSQL & "Where [tblTicket]![DateTimeOpened] = #" & FORMS!frmTicketTracker.unbDateTimeOpened & "#;"
CurrentDb.Execute strSQL, dbFailOnError

View 9 Replies View Related

Using A Combo Box To Populate A Textbox/memo Field

Aug 9, 2005

Dear All:

I have created a form to hold students names, ID numbers, dates, etc. On this form I have a combobox that lists various school names only. From this combobox, I wish to select a school, then the address on the school selected appears in textbox/memo field.

Can anyone point me in the right direction?

Many thanks,

Dion

View 5 Replies View Related

Modules & VBA :: Display / Hide Subforms Based On Yes / No Field In The Form

Oct 4, 2013

I have created a form with 3 subforms on. i was just wondering is it possible to display/ hide these subforms based on a Yes/No field in the form. as the subforms would only be valid if the field is ticked as yes.

View 14 Replies View Related

Forms :: Filter A Report Based On Listbox Selection - Apostrophe In Results

Feb 17, 2014

I use the follwing code to filter a report based on the listbox selection on a form. Below is the code I use, the problem it will error if the results have an apostrophe in the string.

Private Sub FilterDesc_Click()
Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
'make sure a selection has been made
If Me.ListCarrier.ItemsSelected.Count = 0 Then
MsgBox "Must select at least 1 Carrier"

[Code] ....

View 7 Replies View Related

Modules & VBA :: Cannot Update Unbound Textbox

Sep 24, 2013

My form has a button that opens another form on which I enter meeting RSVPs. Then that form is exited. I have an unbound text box on the main form that I want to show the total number coming. I have a summation query that totals the number. I have tried everything I can think of to force the text box to requery. I tried putting the dlookup in the textbox itself, then I removed that and tried all of the things below, both in the gotfocus event and the onCurrent event. What else can I do to trigger the recalc?

Private Sub Form_GotFocus()
Me.numcomingtxtbox.Value = DLookup("howmanycoming", "numcoming") & " Coming"
Me.numcomingtxtbox.Requery
Me.Recalc
End Sub

View 8 Replies View Related

Updating Unbound Textbox On Form Per Record Viewed

Jan 23, 2006

Hey, I am trying to figure out how to update an unbound textbox on a form to reflect conditional data in other boxes when each record is viewed (pages works with reports but I cant find something similar with forms). such as if I had an unbound textbox that I want to = firstname+" "+lastname I would want for it to update it every time a user goes to the next record.. I can't seem to figure out a command or method that executes every time someone goes to the next record.. (and Im not too familiar with all the commands that come without a GUI).. thanks for your time

View 4 Replies View Related

Modules & VBA :: CASE Statement - Display Specific Text In A Field Based On Value Of Another

Sep 22, 2014

I have a lengthy CASE statement in my database that displays specific text in a field based on the value of another. Simple stuff but for some reason it randomly will not work on certain values, and never the same one twice. Is there a commonly known cause for this? I have verified that the spelling and spacing etc. are correct in my code so that shouldn't be causing the problem.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved