Saving Value Of List Box

Apr 20, 2006

Hope someone out there can help.
I have a form (frmNewExceptionRepot) where the record source is a table (tblExceptionReport) there are a fair few controls on the form from this table and some controls that are based on queries etc

I have a cmd button - that takes the value of text boxes from a subform on this form and saves them to tblExceptionReport It also saves the record in general

This all works fine, however I am having a problem saving the value of a list box on the form (not subform) List156 to the table tblExceptionReport. The record source of the list box is a query that only ever produces one result, and its always the first row that needs to be updated to the table.

The data is displayed correctly when the form is loaded, but the value will only be saved if you click on the list box before the record is saved. I understand the theory behind this, as its a listbox an item need to be selected.
However is there a way to tell it to select the first row of this list box as the value?
I have tried various ways around this, but just can't figure it out. Should I be using a text box instread?
I had thought about basing the form on a query that contains all the information, so this list box can actually be a text box, but then it makes the recordset not updateable...which means lots more code on the save - if this is the only way round then fair enough!
Any ideas or help much appreciated!

I have highlighted in red the code currently in use to try and do this. (which works if you click on the list box before running the code.:confused:



Private Sub Command242_Click()
'save record
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'Save the current dates and informaiton to the new record
DoCmd.RunSQL "Update tblExceptionReports set
CurrentVRF = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastVRF],
CurrentLandingSlot = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastLandingSlot],
CurrentPlanComplete = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastPlanComplete],
CurrentReqtsSolWShop = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastReqSolWS]," & _
"CurrentAlignmentReview = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastAlignment],
CurrentDSBBidPictureEvent = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastDSBBigPic],
CurrentCostBenefitEvent = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastCostBenefitWShop], CurrentDSBDetailedEvent = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastDSBDetail]," & _
"CurrentITExecutiveReview = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastExecRev],
CurrentITSupplierPropIssued = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastITSuppPropIss],
CurrentSellByDate = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastSellByDate],
CurrentViabilityReport = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastViabilityReport]," & _
"CurrentProgramBoard = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![LastProgramBoard], CurrentProposedImplementation = [Forms]![frmNEWExceptionReport]![frmExceptionReportStaticData]![Proposed_Implementatation_Date],
OverallRAG = [Forms]![frmNEWExceptionReport]![List156],
CurrentSpendBudget = [Forms]![frmNEWExceptionReport]![List240]" & _
"WHERE tblExceptionReports.ExceptionReportID = [forms]![frmNEWExceptionReport]![ExceptionReportID]"

End Sub

View Replies


ADVERTISEMENT

Forms :: Saving List Box Selection Set?

Aug 12, 2013

Is there an easy way to store a multiselect list box selection?

View 1 Replies View Related

Queries :: Using Variable In A List Field Query - Getting Complete List On Initial View

Mar 28, 2014

In my access form I provide the user a list of locations from various countries in a listbox . But the list is too long so I provide him a combobox for selecting a country. Selecting the country should update the listbox showing only the locations in that specific country.

So my SELECT from the listbox must cover the unselected state and show all entries and when a country is selected it must narrow the selection.

I tried to get this happen with the following SELECT statement containing a variable. Choosing a country in the Combobox results in a change of the variable and in a requery. This works after the first country is selected and for each country change, but the initial list is empty.

VBA in the loadform
'Application.TempVars.Add "varcountryselect", "*"
SELECT in the listbox "lstlocationsperproject"
SELECT tbllocations.locationID, tbllocations.country, tbllocations.localstreet, tbllocations.localcity FROM tbllocations WHERE ((tbllocations.country) Like [TempVar]![varcountryselect]);

VBA in the combobox
Application.TempVars("varcountryselect") = [Form]![kombcountryselect].Column(0)
Me.lstlocationsperproject.Requery

The values in [kombcountryselect].Column(0) are texts like "SPAIN", "MEXICO", etc.

Any hints, how I have to use the * for getting the complete list on the initial view ?

View 5 Replies View Related

Create A Randomise List From A Table And Save The List For Each Month

Dec 14, 2006

Hi All a newbie here so any help will be appreciated,

sorry for the long post but trying to give you all the information you might need.

I wrote a basic access database for my Church to aid in a paperwork audit for a charity food drop which we do monthly to give free food to the needy.

But each month it gets harder to find out who was in line first so I thought with all your help we may be able to randomize the names each month in a different order as to avoid confusion and also avoid people waiting in line as they turn up at 5am and we don't start until 9am.

So if this will work in access they can all come for 9am

I don't mind creating a new database and adding the additional information, if that's what it would take.

My Background I have created basic databases from scratch not using wizards, But I don't know much about code or how to implement it so any help in where code goes it would be very much appreciated.

Database details (Microsoft Access 2002 version)

Table Name = details
Field name = ID (auto-generated)
Field name = FirstName (text)
Field name = Surname (text)

If possible it would be nice to keep a record of the randomized lists (in the database somewhere ?) each month in case anyone wants to see it or disputes the lists, where I can just create a report to show the details.

There will be approximately 90 to 125 names.

Thank you in advance for all your help in this matter

Britgent

View 1 Replies View Related

Reports :: Exclude Individuals From False List If They Are In True List

Jul 15, 2013

I have created my tables and form and am now trying to run reports to organize the data. I have figured out how to group the individuals by group and treatment, but can't figure out how exclude individuals from the final list if they are already in another. As background, some of the individuals are eventually excluded from the experiment, though I keep the initial data. When the exclude individual checkbox is checked ("True" on the report) I do not want the individual to be listed in the "False" list, even though there are entries for that individual when that checkbox wasn't checked (when it was "True"). This is so I can get an idea of the current totals in each group.

Implant Period
>Treatment
>>Exclude individual?
>>>Individual ID

I feel like this should be a fairly simple task, but I cannot figure it out... Maybe there is coding to exclude individuals from the "False" list if they are already listed in the "True" list?

View 4 Replies View Related

Use Multi-select List Box To Filter A Report With Two List Boxes

Nov 20, 2013

Allen Browne's "Use a multi-select list box to filter a report" solution, in particularly with two multi-select list boxes? The code works fine for me for either box so long as I code it for one box alone. Combining the two into one code results in a type mismatch error. I'm trying to use the code to pass the contents of both multi-select boxes as Where conditions to a report. Both boxes are based on number fields. To try to isolate the problem, I've removed Allen's setDescription and OpenArgs conditions. We're unfortunately still on Access 2003 as the company desires to squeeze every dime by using until end-of-life next year.

Code:
Private Sub cmdPreview_Click()
On Error GoTo Err_Handler
'Purpose: Open the report filtered to the items selected in the list box.
Dim varItem As Variant 'Selected items

[Code] .....

View 14 Replies View Related

Created List Box With One Column - Display All Characters Of List Item

Jan 2, 2014

I have created listbox with one column (contains one column only), now i would like to display all the characters of list item (want scroll bar to listbox).

How do i display all text of list item, I have already fixed Column Widths to max length (22";0.1"). However when scrolling to right, it is going to next blank column of list box, which is created only to change Column Widths property.

View 12 Replies View Related

Queries :: Return List Of Records From Original List

Apr 23, 2013

I'm looking to move an excel sheet to access because the row counts are too much.The main thing it does is compare the supplied data against a list I hold in the sheet.There are not duplicate records, however..Some data is a direct lookup for a full match, but much of it is a count to see how many records contain a certain string.

I have 500 keywords which have a countif function in using wildcards.I need to create a query/report which will return a list of records from the original list which contains each keyword featured and how many times it features.I was going to do it in PHPmysql but the time it took to parse a million records for every keyword made it pointless.

eg:
keywords:
look
billy
magic

list:
"have a look and see"
"spanish dave"
"who is billy brag"
"looky looky I go hooky"
"who's the man from argentina"
"could it be magic now"

my spreadsheet would return a 1 next to ""billy" and "magic" and would put a 2 next to "look".

the sheet has the keyword in each row and next to the column:
=COUNTIF(list,CONCATENATE("*@",B13))
where "list" is the external data.

View 3 Replies View Related

How To Transfer Multiple Select Item In List Box To Another List Box

Jun 2, 2012

How To Transfer MultipleSelect Item In Listbox to another Listbox ?

View 7 Replies View Related

Select From List BOX Of List Of Choices And Store This Into A Table

Aug 21, 2013

I created a form and created on it a list box which is a query that grabs certain number of fields from different tables. I would like the user to select from this list box of a choice and then store their selection into a table.This list box has three fields, but it needs to store the id rather than the item, the user would see the name of the item but the id of the item would be store into another table, called bid. It store all these three fields when a user selection one of the item from the list.

View 13 Replies View Related

List Table, Limiting Field List..

Oct 14, 2006

Okay,

The subject is probably confusing but I'll try to explain.
Setup:

Table1
FieldID = Number
FieldName = Text

Table2
FieldID = Number
FieldName = Text
T1_ID = Number

Relationship
Table1.FieldID 1-> * Table2.T1_ID (one to many)

Now, I'm trying to create a 3rd table that has field populated by Table1 and a field populated by Table2 but I want to limit the field populated by table2 by what is selected in the field populated by table1.
Table1:

1st
2nd
3rd
4th

Table2:

1st,January
1st,February
1st,March
2nd,April
2nd,May
2nd,June
3rd,July
3rd,August
3rd,September
4th,October
4th,November
4th,December


Table3:
Table1Field = Number, ComboBox-Source: Table1, BoundColumn=1
Table2Field = Number, ComboBox-Source: Table2, BoundColumn=1

If Table1Field = 1st then
Table2Field Will only allow January, February, or March as selections, since ONLY they are a member of the "1sr" group via the table1 list.

Is this possible, or do i have to do some run-time checking or something?
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner

View 1 Replies View Related

Forms :: List Box - Selection - Populates Next List Box

May 20, 2013

I am wanting to preempt data in list boxes

listbox1
Fruit
Vegetable

listbox2 (If Fruit Is Selected)
Apple
Banana
Orange

listbox2 (If Vegetable Is Selected)
Potato
Peas
Carrot

If Fruit is selected in Listbox1 - Then Listbox2 should have the options
Apple
Banana
Orange

If Vegetable is selected in Listbox1 - Then Listbox2 should have the options
Potato
Peas
Carrot

View 12 Replies View Related

Forms :: Blank List Box Defaults To First Name On List

Feb 2, 2014

I have a Form that links to a List Box which pulls from a combined (concatenated?) list. The list it is pulling from appears as follows: SELECT [Rank]+" "+[Last Name]+", "+[First Name] AS Expr1 FROM [T_Personnel Information]; My issue is that the Field in the Form that pulls from the Field in the Table defaults to the first name on the list when left blank, where as I want it to default to a blank value unless I select a name from the list.

View 1 Replies View Related

Forms :: Filter List Box From Other List Box Selections

Jul 15, 2015

I have a form with 2 list boxes, part number and modification. There is a subform containing another list box that is supposed to show the part information (bpn,vendor,status,etc.) that corresponds to the selected part number/modification in the parent form list boxes.

The part info list box has multiselect enabled and what i want to is be able to select multiple line items and press a button which then sets all of the selected line items status to "Request Removal". This is my code for the button:

Private Sub removeButton_Click()
Dim varItem As Variant
With Me.acbModList
For Each varItem In .ItemsSelected
MsgBox (Me.Status.Value & Me.[Part Number].Value)
Me.Status = 6
Next
End With
End Sub

The msgbox was for debugging purposes. Here's my issue; the for each actually does iterate through each selected item but the value for the line item doesn't change along with it. For example, when I selected 3 items, the msgbox will pop up 3 times but each time will have the same information (first item in the table) even when that item isn't selected.

My next issue is that I am receiving an error message with "Me.Status = 6" stating "You cant assign a value to this object". 6 refers to the id of the status i want to set it to.

View 4 Replies View Related

How To Populate List Box With Another List Box Using Extended Multiselect

Nov 23, 2012

How to populate a list box using another list box on the same form. I have this working completely fine if the the source list box has the multi select property configured to be off, however I need it to be set to extended multi select.

View 1 Replies View Related

Saving A Db

Jan 6, 2006

hi,

thought I was ok at access, obvously not. Think 'briefcase' has messed with my db a bit so started using a backup with ext .BAK. Want to save whole db as another name with ordinary extension. Will only let me SAVEAS on bits of db?

Sorry, I know this is a bit simple but that's about right for me.

Many thanks in advance

Les

View 1 Replies View Related

Saving

Mar 27, 2006

Hi all,
when the users are saving the form, i want to make sure they have filled in certain fields. On previous forms my code has worked, but for some reason on this form it won't, i usually put:


If tankID = "" Then
MsgBox ("Please Enter the Tank ID")
tankID.SetFocus
End If

Can anyone explain why it may not be working, thank you

View 3 Replies View Related

Name Saving When I Need ID!

Feb 15, 2007

Hi there,

I have a table which brings together a number of bits of info from other tables.

Part of the form is acting weird; The user selects an 'applicant', and a 'class'. On the form these are both combo boxes, with info coming from two tables.

Some properties of the two fields:
SELECT Classes.ClassCode, Classes.ClassName FROM Classes;
Bound Column = 1

SELECT Applicants.ApplicantCode, Applicants.ApplicantName FROM Applicants;
Bound Column = 1

Now, I want it to store the ID's of both (rather than the name). Both of these combos have the same properties; however when I look at the table, the applicants ID is being stored, but the class NAME is being stored in its field instead of ID>

Ant idea why this is happening for the class?

View 11 Replies View Related

Saving Options?

Aug 10, 2005

I'm trying to create a database for a taxi-type service that runs on thursday, friday and saturday nights. My question is: Is there a way to save the database at the end of the night separate from the previous nights, and so that the database is empty for the next night, but reports can be viewed for all of the nights combined?

Any help would be greatly appreciated!

-Rusty

View 1 Replies View Related

Saving Problem

May 19, 2006

Hi All,

I have a annoying problem. Since yesterday whenever i make changes to anything in my database, it doesn't ask me if i want to save the changes, it just does it automatically. It is annoying, as sometimes i am testing things, say on a query and if it doesn't work, i just go out of it and don't save the changes and have my original version.

I have another Access database and this works fine, with the pop up message asking if i want to save the changes or not.

Can anyone help, or point me in the right direction, thanks.

View 2 Replies View Related

Saving An MDB File As MDE

Nov 28, 2006

I seem to be having problems saving my database files (.MDB) as .MDE files.

I have a database that only contains data (tables).

A second database is used as the interface to this data (it contains forms, reports, and uses linked tables to the data database).

This secong database file is then copied and used my a few users, so that everyone is accessing the same set of data.

I am trying to save the second database as an .MDE file, but under the Tools, Database Utilities option... 'save Database as an MDE' is never highlighted as a viable option. Is there some trick (or conditions) to enable this option?

I am basically doing this so that I can distribute the MDE version of the interface so that users will have limited / no access to be able to modify the code (or get into the table?).

Thank you for any advice or directions you may be able to pass on.

-arm1

View 4 Replies View Related

Columns Not Saving Where I Placed Them.

Jan 24, 2007

Hi,

I'm new at access but getting the swing of it. It is a pretty cool toy.

I have a table that I am adding various columns of data. Once added I move the columns to where I want them to be. I am hitting the little save disk on the top toolbar but when I reopen the file the columns are not where I placed them. I'm not sure why this is happening. Any thoughts?

Thanks in advance for your help.

Eddie.

View 6 Replies View Related

Updates To DB Not Saving

Jul 2, 2007

Hi

Have a bit of an odd problem with the DB im using at work. I have 1 DB on a shared drive that is accessed by 4 of us from our desktop PC's (password protected via 1 password that we all use - no separate logins).

The problem comes that we make changes to the data, exit via an exit button that uses a save all macro (that all works fine), however when we go back into to DB there are some times that the changes made have been lost and the data has reverted back to the previous version. There doesn't seem to be any specific pattern to this, it happens at random times and to random people.

Does anyone know what may be causing this, or anyway that i can prevent it happening?

much appreciated.

View 1 Replies View Related

Saving Time

Jul 4, 2005

Hi,
I have been tasked to create a database that will be accessed through a dial-up connection to our server.
What I want to know is which is faster
1 Using a seperate table for dropdowns or
2 Using the lookup facility of a table.
cheers

Gordon :confused:

View 2 Replies View Related

Saving Lists

Jan 23, 2008

Hello,

I have a main form where the user can click on a button that opens another form. In this form, the user can make selections from one listbox and they are copied to another listbox.
How can I save the contents of the listbox into a field that is part of the record on the main form? Can this be done?
I have a listbox on the main form where the selected items will be displayed and each record of the main form will have different values for the listbox.

Any ideas?

Thanks,
Mike

View 1 Replies View Related

Saving Forms

Feb 24, 2005

I have created Several Forms but I am not able to save any new records in them.
When I click the add new button the records are added alright. but when I exit the form and reopen it all the new data added to the form is lost.
I even tried the save button but that doesnt help.
anyone has ideas what happening here..

Regards
Rahul

View 2 Replies View Related







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