Modules & VBA :: Updating Dynamic Combobox - Pull Data From Table

Oct 31, 2013

Right now I have a subform with a combobox that pulls it's data from a table. I want the user to either select an existing item or type in a new item and have a macro create the new table row. What I have right now works in the sense that it prompts the user if they want to creat a new item and the new item is created (and I can see it in the combobox list), but I'm still getting an error saying that the item does not exist in the table forcing the user to manually select the newly created list item they just typed in.

Code:
Private Sub MaterialCostCode_NotInList(NewData As String, Response As Integer)
Dim rst As DAO.Recordset
'Update value list with user input.
On Error GoTo ErrHandler
Dim bytUpdate As Byte

[Code] ....

It appears that the new item doesn't always show up automatically and requires the form to be refreshed, so now I need to figure out how to get it to consistently appear right away without a refresh.

View Replies


ADVERTISEMENT

Modules & VBA :: Pull Data From Query (or Table)

May 4, 2015

I have a table that has four columns. Column 1 had people's names, column 2 has their email, 3 has a category, and 4 has their office.

I have a form with radio buttons, When you check a radio button and press OK it will display the e-mails for the people selected. Problem comes when it's by category, since categories are not unique to one person. I want to click the category radio button and have it display every person under that category, concatenated with a comma.

Problem is I can't make a listbox because it will show the same categories several times instead of just once, so I want the radio button with the category name on its label, and then in the code I need to tell Access to go to the table and search for the e-mails from a specified criteria, the category.

How do I do this?

View 1 Replies View Related

Modules & VBA :: Pull Data From A Table That Meets Number Of Conditions?

Jul 3, 2014

I have a module that is in Excel that is connecting to a back end database. I am trying to pull data from a table that meets a number of conditions. With the following statement, it is not returning any records,even though I know there are records that meet all of the conditions. I suspect the problem is with the last condition. In that condition I am trying to say that pull in records where it has been at least 14 days since the last review.

Code:
strSQL = "SELECT tblsojrol_oc.* FROM tblsojrol_oc WHERE tblsojrol_oc.[Status] = 'Pending' AND tblsojrol_oc.[1st Review Date] IS NOT NULL AND " _
& "tblsojrol_oc.[3rd Review Date] IS NULL AND (DateADD(Day,14,tblsojrol_oc.[2nd Review Date])) >= #" & dt & "#;"
objRs.Open strSQL, objConn, adLockReadOnly

View 14 Replies View Related

Modules & VBA :: Updating Table With New Data Value

Aug 11, 2015

I have a VBA script that looks at a date on a form, adds a certain number of months (selected by the user). at the moment i can output the new data to a message box. I want to update a table with the new data value.

This is the code i have so far.

mySQL = "UPDATE job master file " & _
"SET [BBDate] = " & newdate & _
"WHERE [job name] = " & strname

View 10 Replies View Related

Modules & VBA :: Using Combo Box To Pull Data Using (Like)

Jul 17, 2015

What I want the form to do is filter on a column where I have combined 3 columns of actives together. So the form will filter if one of those values is any of those three columns. So I have a macro setup right now trying to filter for anything "Like" what has been selected in the combo box. Here is what I have in the where condition of the filter macro:

Code:

((([Active1] & " " & [Active2] & " " & [Active3]) Like "*" & "[me.cboactives]" & "*"))="'" & [Screen].[ActiveControl] & "'"

This is in Access 2013

View 2 Replies View Related

Pull Data From Another Table?

Jul 27, 2006

I have a table that contains the following:

Code BrandName Lead Free Nickel Free
001 AAAA Yes Yes
002 AAAA Yes No

On a form the user selects the code field and in this table the field is called BRAND. On the same form, I need to display the value in the Nickel Free field so if selects 001, the field on the form needs to be "Yes", if the user selects "002", the value needs to be "No"

View 1 Replies View Related

Modules & VBA :: Search And Pull Data From Db Stored In A Shared Path

Dec 30, 2014

I have two different database files. One is 2010 ".accdb" format where I have created a form and the inputs to the form is getting saved as records to an access.mdb file in a shared path.Now if the users want to edit the existing record I should allow them to search their previously submitted record with a unique ID number.

I know it is possible when we have both the form and table in the same db. But I want to know whether it is possible to search with a unique ID and pull the data from different db in a shared path using a command button?

View 5 Replies View Related

Would Like Field To Automatically Pull Data From Other Table

Apr 28, 2006

Hello Everyone,

I am having trouble with our receiving database. This database consists of two tables. One for vendors, which basically contains their vendor ID as well as vendor name and phone # etc. The other table is our receiving data table. When our receiving person receives product in, they log this in the receiving table including info such as date, autonumber for record, vendor etc. The problem is, when the person selects the vendor id, which is set up as a lookup field, we would like to have the vendor name pop up atuomatically within that record. I cannot for the life of me figure out why this isn't happening. The person is using a form to enter all of this data and runs a summary report at the end of the day. Our accounting dept. is requesting this info be added, but I cannot seem to figure it out.
Thanks so much for any assistance!
Amy (monet1369);)

View 6 Replies View Related

Search To 'pull' Data From Diff Table?

Mar 29, 2006

v sorry for the basic question, but ive been banging away at access and i cant my head around this..

i need to run a simple query. the query/ search will ask users to enter in the number of a document. i want, when this code is entered, for 2 controls on the form be updated with codes that are stored in a table based on the code they searched for originally.

heres my table structure...
Table A
Doc ID (PK)
Doc No (manually input and is the search item that users enter)

Table B
Unique ID (PK)
Doc No (FK)
Info (to populate field 1)
Info (to populate field 2)

how do i perform this in the query section? do i need to manually code the SQL required, or is this query basic enough that i can just select the fields required in the design view of the query?

thanks guys

View 1 Replies View Related

Forms :: VBA Code To Pull Data From Different Table?

Mar 26, 2015

I have a form I use for data entry, it needs to generate an id called RO Number and i need it be generated by access starting at number RO129036 and then keep adding sequentially, so RO129037 etc etc.

as i already have data in my DB that i need i cannot just reset any fields

having a table with just one field - the numeric part of the RO number so first one would be 129036 - so i need the form to pull this field, add 1, and then add "RO" at the beginning of it? i have really been struggling with this database

View 3 Replies View Related

General :: How To Pull Data From One Table And Store It In Another

Nov 10, 2013

I am trying to add an attendance records to my database but cannot figure out how best to do it..I already have a 'children' table were all the kids info is stored and have created a 'roll' table.

i want to be able to open a form and search first and/or last name from the 'Children' table, then be able to save both first and last names and the date into the 'Roll' table. (then open reports etc later based on dates)how to pull data from one table and store it in another.

View 3 Replies View Related

Queries :: Using Criteria To Pull Data From Specific Table

Sep 16, 2013

Is it possible to have a query that uses criteria to pull data from a specific table?

For example: IIf([Result]'"Negative",(tblNegative goes here),IIf([Result]="Positive",(tblPositive goes here].

The tables are just text, but the query would be too long if it was used.

View 2 Replies View Related

Form Field To Auto Pull Data From A Table When There Is A Match

Feb 5, 2013

I have built a nice database that has a form to enter data which logs in product received, there is a combo box on the same form that is linked through the query builder to auto populate the names from the contacts info table (the receivers of the product received) the contacts info table also contains information that is specific to each name such as locations.

As of now I have created a command button that brings me to the form that shows the information fields I need specific to a name, once I get that I have another command button to bring me back to the main form. How to create an additional list box on the main data entry form so as when the name is entered the new list box or text box (which is best?) will auto populate the information I need on one form instead of going back and forth.

Example:

Requester Name [ auto populate name ] currently linked to contacts info table (working)

(New field) Preferred Location [ need to auto populate location ] from the contacts info table (how do you pull locations specific to a contact name from the same table?

View 3 Replies View Related

Queries :: Dynamic Query Based On A Form (ComboBox)

Jan 22, 2014

We have a ComboBox on a form with the months: Jan, Feb, Mar, Apr, etc.

We have fields in a budget table named: Jan, Feb, Mar, Apr, etc.

We want to create a query that pulls the correct field based on the value in the combo box.

This is what I have that doesn't work:

MyField: [Query1].[SumOf] & Forms![Main Menu]![test]

How to do this?

View 4 Replies View Related

Updating Embedded Report Using Dynamic Created SQL Statement

May 19, 2015

I have created a database and have a form (searchpartsfrm) with multiple combo boxes and a text box that builds up all the entries and creates a perfect SQL statement and stores this in strisql variable.

I have a report (showallpartsrpt) embedded on the page that is currently showing every record in the database.

Is there anyway to have this form "refresh" and show only the results of the query by clicking a "search" button?

I believe I need to use the filter command somehow but im not sure how to reference the embedded form. If I try with some test code it cannot locate showallpartsrpt.

View 4 Replies View Related

Modules & VBA :: Filling Combobox With SQL Data?

Oct 6, 2014

I have a select statement (AlphaName and StaffName are variables) in a module that woks fine, its been tested with a basic insert. what i want to do is get this result into a combo box without creating another table?

Code:
strSQl = "SELECT [Week No] FROM [" & AlphaName & "_Hours] WHERE [Alpha Name] = '" & StaffName & "';"
Me.Week_Cmb.RowSource = strSQl

View 7 Replies View Related

General :: Updating Table Data With Data From Preceding Entry?

Jan 5, 2013

My question is this: I have a table where I'm entering employees' hours worked. Basically, it's something like this:

ID WorkerNumberDateworkedTimeStartTimeEnded
121/2/201310:00:00 AM3:00:00 PM
221/3/20132:00:00 AM11:00:00 AM
321/4/201312:15:00 AM11:30:00 AM
421/5/201310:25:00 PM11:00:00 AM
531/2/201311:00:00 AM3:30:00 PM
631/3/201312:00:00 PM10:00:00 PM
731/10/20137:00:00 AM4:00:00 PM

I have a query that (easily) determines how many hours an employee has worked on any given day. What I can't figure out at all, is how to write a query that can figure out how much time an employee had off in between shifts.

Thus far I'm able to run a query that separates this main table into individual workers by their id numbers, but can't figure out how to determine time off between shifts - as the last hour worked one day, and the first hour worked the next day are on two different lines (they are two different table entries).

View 4 Replies View Related

Modules & VBA :: Excel Data Connection Not Updating?

Mar 17, 2015

I have an excel spreadsheet that uses a data connection to a website to download text. I have the data connection properties to refresh upon opening the file. If i double click the file from windows, it updates. Although using the code below doesn't work. When i've added the code ObjXL.Save before closing it, it usually saves a file with no data and no cells. I'm eventually going to switch visible to false.

Private Sub btnDownLoadSettle_Click()
Dim XLapp As New Excel.Application
Dim ObjXL As Excel.Workbook
Set ObjXL = XLapp.Workbooks.Open("C:...Settlements.xlsx")
ObjXL.Application.Visible = True
ObjXL.Windows(1).Visible = True
Sleep (5000)
ObjXL.Close
XLapp.Quit
End Sub

View 2 Replies View Related

Modules & VBA :: Updating Data Between Database Versions

Sep 17, 2013

I have been asked to add features (and fields) to an existing database containing private medical data. The idea is to add features to the empty database, test it with fake data, purge the fake data and deliver it to the user in another state with a simple update button. The Access 2010 database is in one piece (No front/back end).

I am looking for the best/shortest VBA method to move a lot of preexisting field data from the old database to the new version. I think I have it mostly figured out; I have code for counting, reading and writing the table names, field names and field data.

However, because the data types vary within the tables and there will be new fields in the new versions tables, my only idea, so far, is to code through the data table-by-table and field-by-field, a lengthy process with a large footprint. Moving entire tables or complete records may not be effective. Any faster way to transfer all these tables field data?

View 3 Replies View Related

Modules & VBA :: Updating Master Table From Temp Table

Jun 5, 2013

I have two tables that are formatted identically....

Table1 = MasterTable
Table2 = TempTable

I am taking a copy of one of the entry from the master table and Copying it to the temp table.I then open a form on the TempTable that enables the user to modify the content without affecting the information in the MasterTable.On Completion and Save I wish to take this modified content and update the MasterTable Using the Field "ID"

the tables for example look like this

ID NAME AGE DATE1 DATE2

I am guessing I need to use a

Code:
DoCmd.RunSQL UPDATE "MasterTable" WHERE "TempTable"

Type of command but not to sure on the correct syntax and as everything is the same the use of wildcards for all fields

View 10 Replies View Related

Modules & VBA :: Updating Table Where Table Name Depends On Combo Box Value

Jan 17, 2014

I am trying to update a table with the value of a text box on the form where the table to update is as selected from a combo box on the form.I keep getting the following

Error message:
Run-time error 2465
Microsoft Access cant find the field & table_to_update & referred to in your expression..

But really can't see what I've done wrong. Have checked that the table_to_update string does contain the name of the table so guess it must be sql..

Code:
Private Sub Command91_Click()
Dim table_to_update, sql_string As String
table_to_update = Me.Combo49
Debug.Print table_to_update
sql_string = "UPDATE [" & table_to_update & "] SET [" & table_to_update & "].[Project] = """ & Text89.Value & """ WHERE [" & table_to_update & "].[ID] = " & Forms![T_entity]![" & table_to_update & "]![ID] & ""
db.Execute sql_string
End Sub

View 1 Replies View Related

Updating Data In Table B Based Off Table A - Duplicates

May 19, 2013

I have two tables, Table Products & Table Sold and I'm trying to aggregate the products table to reduce the total number of products and I want this update to happen with all tables that share a 1 to many relationship with the product table. (table sold is one of those).I have products apple, pear, bananna. I am now aggregating them to all just be called fruit. Problem is when I make this change in the product table I get this error:

"The changes you requested to the table were no successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again."how to go about aggregating data in a table that has 1 to many relationships with many other tables. A

View 2 Replies View Related

Combobox - Specify Data To Be Pulled From A Table

Oct 12, 2011

I setup a combo box where I specify the data to be pulled from a table. The table just contains the primary key (id) and a name, which is what I want loaded in the combobox pulldown.

When I run the form, the names appear but when I select, the id is written to the table instead of the name.

What settings am I missing and why is it taking the id instead of the name ?

View 2 Replies View Related

Modules & VBA :: Displaying Specific Fields Of Data Set Based On Combobox Choice

Sep 19, 2014

I have a Table with 57 fields. I would like to display this table in a form as a subform, but only certain fields depending on what selection is made in a combo box.

For instance, if the user selects "Missing Information" in the Combo Box, then the form will show a few standard fields such as ID, Market, Sales Manager, and then some specific ones such as date missing information requested and date missing information received.

If the user selects another option, again the standard fields will remain plus a few different ones.

I have done much searching on this and feel like I am so close but so far. I have looked into controlling the record source of the subform, columhidden =false and a multitude of others. All of which may or in fact probably do work in this situation but I can't seem to put it all together.

View 4 Replies View Related

Modules & VBA :: Combobox To Delete Records From Table?

Sep 6, 2013

I have a very simple 2010 Access database with only one table which contains a few fields (username, email, phone....)

I have a combobox with unbound controls to search/find users (by the lastname field). The combobox is in the header section which populates the fields (controls?) in subform below.

I have a delete button with some VBA code which allows the user to delete the currently displayed record however when the form refreshes, I end up with two issues:

1: I see #deleted# in the combobox dropdown until the dbase is closed/reopened (it's only typically used by one person at a time.) Compact/Repair doesn't seem necessary, especially since i think it's pretty difficult to do this programatically (?)

2: There are blank rows in the combobox dropdown from where the data used to reside after deleting the record.

I haven't been able to figure out how to remove those blank rows and refresh the combobox to display the remaining records (with the blank rows removed). So I have dozens of blank rows. Me.Requery doesn't seem to work.

My assumption is that the blank rows exist because I'm deleting the content from the combobox's initial creation?

Is there a better way to allow user's to see the list of user's and then be able to select that record and delete it?

If I use a simple search box on a form where people have to type a (last name for example), if it's spelled incorrectly, then nothing would be found.

View 5 Replies View Related

Updating Fields In Table With New Data - Help

Jun 17, 2007

Hello

I have a table with 3 fields:
- ID no (primany key), Time1 and Time2
I have 3 records with ID no 1 to 3.
So my table look like this

ID no: Time1: Time2:
1 [emty] [emty]
2 [emty] [emty]
3 [emty] [emty]

I have an Excel document with the data for field Time1 and another Excel dokument with the data for field Time2. Excel doc1 have 2 colums named ID no and Time1. And Excel doc2 have 2 colums named ID no and Time2.

How do I import/update these data into my table?

I have tried wiht a adding-quiry but it only works if the table is complety emty and only with one Excel doc. Trying the second Excel doc afterwards only makes an error and no fields are updated.:confused:

View 4 Replies View Related







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