General :: Combo Box Referencing One Table - Inputting Value From Different Table
Jul 11, 2013
I am trying to use a combo box to select the Company in an input record form for my Transactions. In the Transaction table, each record contains the Company ID, but not the company name (I have a relationship with a Company ID primary key in a separate table that has all the companies information).
I would like to be able to select the proper company in the combo box and have the form save the value as the Company ID number with the rest of the input data in a record (it will then refer to the correct company name in the other table if I query it because of the ID key).
I have a form where it is necessary for the user to input number of tanker loads, however I would ideally like the table to store the information in m3 which means multiplying whatever the user inputs by 11.3.
My plan was to use an unbound textbox for the user to input the "number of loads" into, then use a query to calculate the value and then a Dlookup to update the value of a control which will be hidden somewhere on the form. I got as far as making the query however then realised that it won't let me add an unbound textbox to a query in order to form an expression. I'd like to stay away from the inbuilt "calculated field" option just in case i need to downgrade to an earlier version than 2013 at some point.
I am using Access 2010 and I currently use a command button on a form to add new records to a table using data that the user has entered into the form using the code below:
Although this is pretty self-explanatory, here is a key for reference:
Code: Private Sub cmdAddMet_Click() Dim DB As DAO.Database Dim RS As DAO.Recordset Dim strSQL As String Dim i As Integer Set DB = CurrentDb
[Code] .....
This works great but I would like to be able to pull in data from another database based off of Me.lstFacilities.Column(1, i) which is the FACILITY_ID field and is located in the other database's table. I thought about adding in another string variable(strSQL1) and opening up a separate recordset and database:
Code: Set DB1 = OpenDatabase("serverotherdb.accdb") strSQL1 = "SELECT [FieldName] FROM [tblOtherDatabase] IN 'serverotherdb.accdb'" Set RS1 = DB1.OpenRecordset(strSQL1)
However, I'm not sure where to start pulling in the data from the [fieldname] in the [tblOtherDatabase] when I start the loop below:
Code: For i = 0 To lstFacilities.ListCount - 1 If lstFacilities.Selected(i) = True Then RS.AddNew RS!RELATIONSHIP_ID = Me.lstFacilities.Column(0, i) RS!MEASUREMENT_PERIOD = Me.cboMeasure
I'm making a large database. There are over 100 questions per "chapter" of the data I need to enter. The forms aren't large enough to accept everything at once so I broke up the chapters into a few smaller forms. The problem I'm having now is it saying "you can't go to the specified record" whenever I enter the same company name in two of the forms for the same chapter. The company name is the primary key. How can I make it so the techs can go from page to page without breaking up my tables? Thanks in advance. Sean Sturts (USMC)
I'm fairly new to access and have been tasked with fixing a database that to my knowledge is built incorrectly but due to budget constraints and the time it would take to build a new one, we have to stick with this one. Here's my problem, in the database is a form that we use to create new entries in a table but when I try to create a new entry through the form, it creates multiple entries in the table with the rest of the data split between all the new table entries. Is this something that is caused by us moving over to the most current version of Access? Is there a way to fix this problem given the software we are using? At one point I had recreated this table because we had been having issues with other aspects of the database (security deposits were not being updated when entered through this form).
I am trying to build a db to track all the different projects I do on my web shop www.mutzigcreations.com (http://www.mutzigcreations.com). One thing I need to do is to be able to track the different materials I make things from. This wouldn't be to bad, but sometimes I use several different materials in one project and for the life of me I can't figure out how to do a table system (or form for that matter) that would let me do this.
I build out of woods, acrylics, and other special materials so I have a table for each of the 3 main types. Then I created tables called Material-1, Material-2, etc..that did table lookups to the 3 main type tables. These tables (material-1, etc..) are then related to my main table called Creations. (is this the correct way to go about it? as I can't seem to get it to work at all)
I would eventually like to set up a form that would have a check box next to Material-1, Material-2, etc...that would enable me to select:
A. if more than one material was used B. What the materials were.
I didn't want to make several copies of the 3 main tables (wood, acyrilcs, special) as that seemed counter productive since the same info is used for each of the different material-1, material-2 selections.
Can anyone help me figure out what do to, or the best way to do it?
have used the wizard to take values for a table dropdown field from another table
the table has
surname forename and class all of which reside in another table... ive tried to set up the bound columns so when you select a surname from the drop down the other two fileds also referencing that 6able are automatically filled in with their corresponding values.
so if the ref table had
smith john 1m
by selecting smith in the new tables drop down, the forename and class fields automatically select the corresponding values from the ref table..
im sure this is possible but cant get it to work and cant find anything on the web (although this is probably down to not knoing the right search string)
Having (with much help from many of the experts here) overcome the hurdles of junction tables, subform to subform movements, and the seemingly easy design issues of a form, I have now created a self-referencing table. I humbly return to ask for advice from those experienced with these relationships...
I have been led to this in order to load in to my DB a certain class of documents, linking them relationally to their parent documents, while performing the data input for both into the same form. What I have done and what the problem is are as follows:
I created a new field in my form (formDoc), "LinkedExhibit". In the relationship window, I reloaded the Document table and reestablished all prior relationos, then added a second (alias) table Documents1, linking the primary key of this alias to the LinkedExhibits field.
I have the Linked Exh field set up as a combobox linked to DocTitle from the Documents table ONLY for the purpose of saving keystrokes if a duplicate should arise.
Unfortunately, when I enter a new document and then continue entering data through the LinkedExhibit field, and save by moving on to another subform related to these, the Documents table shows all of what I typed, except it shows the Linked Exhibit saved as DocTitle, and the DocTitle that I had typed is gone...
I really am flying blind but believe the alias table is not linked right, or I am using that concept to do something it cannot do...
I am attaching the DB, in Access2007, if someone could lend an eye to it... I would appreciate that.
I tried the idea sugested in post (http://www.access-programmers.co.uk/forums/showthread.php?p=423080#post423080) but it didn't seem to give the cross referencing that I had hoped for .... example 1 is related to 4,3, and 5 while 6 is related to 1 thus implying an extended relationship to 4,3, and 5.
In a standard one-to-many I'd look at record 1 and see that it is related to 4,3,5 but if I were to look at record 6 I'd only see that it is related to 1. How would I set up the table relationships to drill further to see that 1 is also related to 4,3,5?
How do you do a many-to-many from one table back to that same table?
tblEvent EventID(AutoNumber) EventTitle(Memo) 1 memo content 2 data 3 more memo content 4 some info 5 more stuff 6 other text
My search was snowballed with lot of results about dealing with split database, seeing who's online, etc. so I'm not sure if that is a good idea.
I want to make a table of Users because my users may need to put their name on some of reports, so I could use CurrentUser() to figure out who's who and put down their proper name after comparing the username via a query.
However, I'm not sure if it's possible for me to link the user table to the user groups of database to ensure that there's no ghosts or users that doesn't have a proper name to be placed on the reports or whatever. More of a validation, really.
Is that doable or maybe there's another way to do that?
So I've created 3 tables - one for each information group arranged like so. However my problems are - I don't know how to make it so that as soon as all the info for one set of parts is filled another set automatically appears? And in the Design section of the Form I have the following error because I wasn't too sure what to use apart from a text box-
My combo boxes are not returning the actual combo box values back to my table, instead in the table it is displaying the combo box data list number i.e 1,2,3,1,5,1 etc where it should be displaying a property address.
I have a database where on the form we are just put in total deductions. We want to make sure that the total deductions is correct so while we are entering this number we want to do an excel thing by hitting = 1 + 1. Anytime we do that we are getting an error message. I really didn't want to have to set up a table to store these different amounts because we really only need the total. Is there a way to do that? I changed the format from currency to general but I'm still getting the error.
I need to add new records to a table depending on what the cbo box displays. I figure this is the way to do it but I it's not working, I have only writen the first select,
Private Sub Comando6_Click() Dim dbPalavraChave As DAO.Database Dim rstchaveCFEPC As DAO.Recordset Set dbPalavraChave = CurrentDb Set rstchaveCFEPC = dbPalavraChave.OpenRecordset("chaveCFEPC")
I have a AUCTION form, it has a combo box and the label for this combo box is called seller. This combo box is a look up to the USER table which has the following fields:
uid, uname, city, state
The combo box is pulling and displaying a drop down list of uname from the USER table, with this SQL state in the "row source".
Code: SELECT user.uname FROM [user] ORDER BY user.uname;
In the control source of this combo box I have seller, and the form's record source is AUCTION, tagging on the AUCTION table.
The problem is the form is putting the uname into the AUCTION table's seller field, but I want it to input the uid field, however that it should still show the uname list when the user click on the combo box to make a selection.
I have to combine groups to account, then when account is a group in next time, list or combobox, this group must not to be in that list. what is the solution ? SQL or VB. I append file...
I'm jumping to the forms development and going to try what I need via queries and SQL. I'm trying to do a series of cascading combo boxes which have worked out fine, right till I hit the first junction table.
I will include the VBA code below as well as a screenshot but here's how it goes.
REGION cascades down to COUNTRY cascades down to PORT and then to CARRIER.
This is for a shipping program.
When it gets to PORT and are trying to cascade to the various CARRIER's thats where it hits a junction table of PORT_CARRIER.
Here is REGION to COUNTRY:
Me.cboCountry.RowSource = "SELECT COUNTRY.CNTRY_ID, COUNTRY.COUNTRY FROM COUNTRY " & _ " WHERE REG_ID = " & Nz(Me.cboRegion) & _ " ORDER BY COUNTRY" Me.cboCountry = Null
COUNTRY to PORT :
Me.cboPort.RowSource = "SELECT PORT.PORT_ID, PORT.PORT FROM PORT " & _ " WHERE CNTRY_ID = " & Nz(Me.cboCountry) & _ " ORDER BY PORT" Me.cboPort = Null
PORT to CARRIER:
Me.cboCarrier.RowSource = "SELECT PORT_CARR.PORT_ID, PORT_CARR.CARR_ID FROM PORT_CARR " &_ " WHERE PORT_ID = " & Nz(Me.cboPort) & _ " ORDER BY CARR_ID" Me.cboCarrier = Null
PORT to CARRIER is where the problem is.
It populates the combo box, but with the ID numbers instead of actual CARRIER names.
(the Junction table are two PK fields and are lookups to PORT in PORT table and CARRIER in CARRIER table.)
Is there a magic spell for cascading combo boxes when you hit a junction table?
I have a table with only two fields and one record: BegDate and EndDate (beginning and end date of the reporting period respectively). I also made a function with variables that look up those values for use as a date parameter in a query.
Here is the code:
Option Compare Database Option Explicit Public Function getCurrentRepDates() As Date Dim dtBegDate As Date dtBegDate = DLookup("BegDate", "tblCurrentRepDates")
[Code] ....
I am getting a syntax error for the line marked red. How can I use "Between" function in VBA code? Access 2010
Is it possible to create a query to select all dates from a given reference date? I don't mean all dates in a table - I mean all dates generally?
(The idea being to fill the first field in the resultant dataset with the list of dates, then run subqueries off that to fill the remaining calculated fields)
I'm currently using a date field in one of my tables to populate this first field (the full SQL is in a separate thread here)
But that was just a convenient way of getting a list of dates; the dates in that table don't actually have any significance to the resulting dataset (other than they should roughly overlap with the dates I'm looking for)
The flaw in that method is that the table from which I get those dates can only ever have dates up to and including yesterday. I also need to get today's date in there (and calculate the subqueries based on that date as well).
It's also possible - although unlikely - that there could be random dates missing from that table as well - in which case I need to plug those gaps and calculate my fields for those missing dates as well.
For clarity; that first field (AsOfDate) should contain every weekday from the earliest date in that table (i.e. Min([tblBalances].[BalanceDate]) up to and including today. It doesn't matter if any of the dates inbetween are missing from tblBalances as the subqueries will just return zeroes for those dates (which is exactly what I want to see).
I have a main menu "MainMenuF" in my database and I would like the database to be able to be searched by any of the column headings. For example I have a table titled "NewLabReportT" this table has many column headings like "Submitted By" "Reviewed By" "Title" "Abstract" etc...
I would like my users to be able to click a radio button with the same column headers on this main menu and have a box that pops up to say "Enter search parameter" and have that parameter be searched in the table "NewLabReportT" and generate a FORM not a REPORT of all of the listings in the database that have that keyword associated to that certain category searched. That way they can "CLICK" the exact field they are looking for and have it open right up to that form.
I have a Table (tblFPAData) that is being populated with entries from a form I created. There are several fields but if I can get an answer for one relationship then I can repeat it for the others.
In tblFPAData there are the fields MaterialNo and Description.
I am creating another table called tblSchedule and using a form to enter the information. I need the user to select the MaterialNo from a combo (cmbMaterialNo) and the then table auto populates the Description from tblFPAData.
Basically MY problem is that i set the control id to that of a primary key so that when the combo box data is changed it puts the data in the table. However my problem is that the data it displays is a price and im trying to calculate a total. Therefore in VBA im trying to find out how to refer to the data displayed in the combo box but isnt the control source.
Thank you in advance Any help would be much appreciated
How to reference a value on a combobox in one form from an object on another form.
I have put in =Forms![Company Name].Combo7 in the field object on the form and I have got the ID autonumber of the Company Name. So far so good. It worked.
When I put in =Forms![Company Name].Combo7.column1 to get the company name to appear in the field I got an error.
What is the correct entry that needs to be entered?
When the value "X - DISCONNECTED" is selected in the form I want the record to be removed from its existing table and sent to a new table which keeps all the "X - DISCONNECTED" records together.
Any ideas would be greatly appreciated. How would this be coded?
I need to be able to update tblManifestData with a new manifest number and manifest comments, along with assigning it a TSDF. how to be able to enter a new manifest number and the associated data without having it create two lines in tblManifestData. I thought that I could enter a new manifest number, then requery the table and form so it shows the complete list of manifest numbers (including the recently entered one) while staying on the newest entry.