Populate A Bound TxtBox And Not Have It Update Table?
Mar 12, 2008
It's an unusual request, I know, but it's necessary for my purpose.
I have a form, frmMain that I use to update a number of tables. On it is a number of combo boxs, comProduct, comBrand, comSize, comPrice and comQuantity. comProduct opens a new form, frmNew if the users input is not already in the table. On frmNew there are again combo boxes comProduct, comBrand and comSize. This form adds the record to the table.
So, if I input a new value - not already in the database - for product in the comProduct combo box, the form frmNew appears and I can proceed to define the product, brand and size of the new record. The form then closes and reopens frmMain and tabs across to comQuantity (skipping the fields I've already defined in frmNew).
Now if you can wrap your head around that, here is the problem: Because I've already entered the values for product, brand and size in frmNew, I want them to automatically appear in the appropriate combo boxs on the frmMain form. I've been using the following code (executed from frmNew, so Me = frmNew):
Code:[Forms]![frmMain].[comProduct] = Me.comProduct[Forms]![frmMain].[comSize] = Me.comSize[Forms]![frmMain].[comBrand] = Me.comBrand
It works, but I've since discovered it creates a new record in the table so I end up with two duplicate records (one when I submit frmNew and another when the values are automatically input into frmMain.)
Now, my question: How can I display these values in frmMain without having them create the second record? I was thinking of using a SELECT query somehow, but I don't know where to begin. I also considered using labels instead of comb boxes, but I'll need to be able to edit them if the record already exists.
View Replies
ADVERTISEMENT
Jul 17, 2013
How to automatically populate the bound text box with data from a table for a specific entry. This is the code I wrote
Private Sub ListBox_DblClick(Cancel As Integer)
Dim ListBoxSel As String
ListBoxSel = Me.ListBox.Value
Call proc_Update_TxtBoxes(Me.ListBox.Value)
DoCmd.Close
[Code] ....
View 3 Replies
View Related
Feb 5, 2014
I would like to populate form fields with records from a table/query so that they are bound to the recordsource and the record to be displayed can be selected from a combobox. I am hoping that in this way, any changes made are propagated to the original table.
I have created a combobox from which the primary key can be selected and added all the fields from the table appearing on this form as values.
In my Change event for the combobox I have this code:
Private Sub cboID_Change()
Me.RecordSource = "SELECT b01_Participants.*FROM b01_Participants WHERE (((b01_Participants.ParticipantID)= " & cboID.Column(1) & "));"
Me.Refresh
End Sub
However, I receive an 3075 error when this code runs which seems to relate to my syntax or an extra ")".
View 14 Replies
View Related
Jun 7, 2014
I have a form that has a combobox and a field text. If i select any value in combobox i want to update the txtBox but not with the ID of the selection. I need to get the description of the combobox selection which is essentially the Column 2.
View 3 Replies
View Related
Sep 15, 2005
Hi there
Can someone give me a basic example.
I have a form that contains a textbox and a listbox. The listboxs rowsource is tblSPNZ.
The table has 2 fields 1 is and autonumber and the other is where I want the results to go.
How do I make a command button populate the table? Avoiding putting any results into the autonumber field?
Thank you for your help.
View 11 Replies
View Related
May 6, 2013
I would like to have a table update query populate cells in a field, based on an IIf statement (below), but states that the IIf statement arguments still need to be enclosed in parentheses. I don't understand what the problem is, I have two sets of opening / closing parentheses.
Code:
IIf IsNull (=Mid( [CONTRACTOR_TASK]![TASK_NAME] ,6,6))
View 3 Replies
View Related
Sep 7, 2006
I need to have 2 textboxe son my form that are directly linked to data in a DB so that the user can type values in directly.
Unfortunately, the data for these 2 textboxes is completely separate from the main form's recordsource.
Is it possible to do this using an expression? I've tried but it only retrieves the data rather than allows you to update it.
If not, then will I have to do this through VBA code?
View 2 Replies
View Related
Aug 16, 2006
I have a form with several fields bound to a table, and also a listbox of records that are not bound to any table. What I want to do is to be able to double-click a record in my listbox and have the record show up on my form in a particular bound field, and also become a part of the underlying table's record.
Is it possible to do this? If it is, how would I do it?
Thanks in advance to all who are willing to help!
View 4 Replies
View Related
May 3, 2013
I have a Main form with several sub forms on it the tables behind each form are related tables. The user enters data on the main form with the exception of one bound control then moves on to enter data on the sub forms On exiting the record or the main form I want to take data from several of the sub forms and add them together and enter result in the bound form on the main form. Because this bound control is not used to enter data in there are no event triggers to code to get this done.
View 3 Replies
View Related
Feb 6, 2005
I have a database that has student table (I am not a student doing an assessment!) with a one to many relationship to coursebooking and then a course table that has a one to many relationship with the coursebooking table so coursebooking seems to be acting as the link table between the many to many relationship. (I didnt design it).
I am creating forms to make the booking process faster and to perform the correct sums to produce an invoice and update a financial transactions table along the line.
I have an entry form that creates the student, and then other forms synchronise to the master form and gather the data. I am now at the point of wanting to get product details so ex course A, taxi to school and enrolment fee and add these to the booking table.
Historically the process was messy and couldnt calculate course A cost (per week) times by number of weeks.
I want to be able to select the products from a combo to build up an invoice and then once acknowledged as details correct commit to the tables coursebooking and transaction table.
I am not sure how best to achieve this ie is it best to have a bound form to the booking table and add new records to it line by line or to use an unbound form and some kind of product picker and to see the products built up perhaps using vba and storing products in an array until ready to post.
Some advice would be most welcome.
regards
Peter
:eek:
View 1 Replies
View Related
Jan 31, 2005
I have a form which I've spend many hours designing to look and behave as I need it. It is bound to a table (get's it's data from there). I now want to add one or more new fields to the table (which I've done ok), but I can't seem to get the Form to see those fields. I've tried creating new controls on the form and the control source list to select from doesn't include my new fields.
Even if I write VB code embedded in the form to refer to the fields, the debugger trips on the field names saying no such method/object. The only way around it I've discovered is to create a new bound form which will mean re-dooing al the layout work again.
Surely this is a common situation which has an easy solution ?!!
View 4 Replies
View Related
Aug 31, 2014
I have some VBA code that generates a query and saves it. The query is a list of people who will be sent a communication along with the formatting for the communication. After producing the query I want to look through it and decide if there is anyone I don't want to send the communication to. I can't delete records from the query without deleting them from the database or I would simply do this.
I thought I could add a checkbox in the query that I can tick to stop a communication being sent to that person. I only want the setting saved within the query and then when I have finished it be deleted along with the query.
View 5 Replies
View Related
Mar 22, 2014
I have 4 fields that are unbound on a form. img1 img2 img3 img4..When these are entered they are all combined and autofill another unbound textbox = imagename.. what i would like to do is from this unbound textbox 'imagename' ..i would like to populate a textbox that IS bound called FileName
[Event Procedure]
Private Sub imagename_Click()
Me.imagename = Me.FileName
End Sub
View 4 Replies
View Related
Apr 17, 2015
I have a form based on a query. I'd like to add a search box to the top to look up values and then populate the rest of the form. I can't do it with the combo box wizard because the relevant (third) option doesn't show up, I assume that's because the form is based on a query not a table.
Any alternative method of adding a search?
View 4 Replies
View Related
Oct 16, 2013
I have a simple login form (really just an audit tracking form) that requires the person to enter in their email address and select an office number from a combo box. Essentially, upon first entry, they will put in their email address and select an office number. When they return to the database and put in their email, it will automatically populate the combo box.
I need the text box (EmailLogin) to do 3 things: update an EmailLogin field on a table called EmailLogin (which I already have it set to do), search a field called EMail in a table called Staff, and update a combo box (cboOfficeNumb) below it if it matches an entry from EMail on the Staff table with the field OfficeNumb.
I have the cboOfficeNumb updating the OfficeNumb field on both EmailLogin and Staff tables.I am unsure of how to use a Query to perform the search and use DLookup for the update of the cboOfficeNumb.I am okay with modifying the tables to remove OfficeNumb from the EmailLogin table, as it is really just tertiary.
View 14 Replies
View Related
Aug 26, 2014
I have a form AddNewEquipment. This is bound to a table, EquipmentDetails.
EquipmentDetails has a Yes/No field, 'ParentChoice'. So when EquipmentDetails.ParentChoice = Yes, I want to open up a new text box, AddNewEquipment.ParentDescr, into which someone can put some text. This text I want to append as a new row in a different table, ParentList.ParentName. (that table also has an autonumber field)
I only want to do the save when I save the whole form.
Is this something like using an On Lost Focus event from the ParentDescr field which only invokes when the overall form save button is clicked? What would I put in the On Lost Focus event.
View 9 Replies
View Related
Oct 22, 2014
I try to put an expression for the property "bound column" so that my lookup values will be directly dependent on one of attribute's choice
I have got four options for my attribute. Each option will use a slightly different set of lookup values. I save all four sets in another table.
Then in my properties definition I refer directly to this table as lookup base. When I put bound column number equal to an expression so as to choose the right column of lookup values it refuses. It seems that it does notl ike anything other than a numeric value.
If that's a no-go, I am not sure how to achieve what I try to do then?
Essentially I have a table that 4 attributes: QID,itemID,CatType,Catchoice
CatType can have only 4 values. Each value will make Catchoice take on a different set of combo values
The problem I am having is that I am stuck at the Catchoice lookup definition because it is dependent on what kind of CatType the user picks.
View 1 Replies
View Related
Mar 30, 2006
I have a form that has several fields that a user will enter data. When finished, the data is inserted into a table. Works great. What I want to do now is look at one of the fields entered and if it is equal to a certain value, I want to disable one of the other text boxes (fields) on the form AND pop a screen that will allow the user to enter a list of names that will update a different table.
So, if user inputs a directory name GENERIC, the txtScriptName box needs to be disabled/greyed-out and I need a form to pop so the user can put in a list of script names. If any other directory name is entered, the txtScriptName box needs to remain editable. (For directories equal to GENERIC, there will be multiple script names instead of just one)
I've been successful at getting the form to pop if GENERIC is entered but can't figure out how to grey-out the txtScriptName field. I tried using Me.txtScriptName Locked in the Before Update of the preceding field but it didn't work - could still update the txtScriptName field.
Any other sugestions?
Thanks!
Mary
View 1 Replies
View Related
Nov 13, 2012
I am populating a table using combo boxes in a continuous form. The box box alone works fine without any issue of repeated data. But as you know obviously the combo box only populates data in a single column of the table, in which case mine is the LASTNAME; so now I am attempting to populate a unbound textbox with the FIRSTNAME side-by-side with the combo box for the same record.
In the After Update event of the cboLASTNAME:
Code:
Me.txtFIRSTNAME = Me.cboLASTNAME.Column(3)
However, after updating the the combo the textbox data is repeated.
Is there a possible solution to this?
View 2 Replies
View Related
Jun 30, 2014
I have created a form that is bound to a table.
There is a button on the form that allows users to send email with the form as an attachment in pdf. I'd like to create a date/time stamp in another table called tblLog. Trouble is the code works uptil sending emails but it doesn't record the stamp.
Heres what I've done so far.
Private Sub cmdEmail_Amd_Click()
On Error GoTo cmdEmail_Amd_Click_Err
DoCmd.OpenForm "frmAmendment_Master", , , "[Record_ID]=" & Me.Record_ID.Value
DoCmd.SendObject acForm, "frmAmendment_Master", "PDFFormat(*.pdf)", "", "", "", "Amendment Form" & " " & Surname & " " & Firstname, "", True, ""
[Code] .....
View 3 Replies
View Related
Jul 4, 2005
Hello,
I'm trying to make a report query work but with no succes so far. Can anyone please help me?
I've got a multiselect listbox and a txtbox (txtCursisten) where the results from the multiselect listbox appear.
I want to get the results out of a table (tblAbsentie) where I can set a start and end date AND use the people selected in the txtBox. So far I've got a NOT working query, a report based on the query and a button on my form.
The VB code behind the "show report" button is this:
Private Sub cmdAbsentiePerCursistPerPeriode_Click()
On Error GoTo Err_cmdAbsentiePerCursistPerPeriode_Click
Dim db As Database
Dim Q As QueryDef
Dim sql As String
If IsNull("Me.txtCursisten") Or Me.txtCursisten = "" Then
Exit Sub
Else
Set db = currentdb()
Set Q = db.QueryDefs("qryAbsentiePerCursistPerPeriode")
Q.sql = "SELECT tblCursist.Naam, tblAbsentie.Datum, tblAbsentie.Lesuur, tblAbsentie.AantalLesuren, tblAbsentie.Deelkwalificatie, tblAbsentie.Docent, tblAbsentie.Gemotiveerd, tblAbsentie.Reden, tblAbsentie.Status, qryCountLesuren.SumOfAantalLesuren" & _
"FROM (tblCursist INNER JOIN qryCountLesuren ON tblCursist.OVnr=qryCountLesuren.OVnr) INNER JOIN tblAbsentie ON tblCursist.OVnr=tblAbsentie.OVnr" & _
"WHERE (((tblAbsentie.Datum) Between [Voer begindatum in] And [Voer einddatum in]) AND ((tblAbsentie.OVnr) In ("Me!txtCursisten"))); "
Q.Close
DoCmd.OpenReport "rptAbsentiePerCursistPerPeriode", acPreview
End If
On Error GoTo 0
Exit Sub
Exit_cmdAbsentiePerCursistPerPeriode_Click:
Exit Sub
Err_cmdAbsentiePerCursistPerPeriode_Click:
MsgBox "Selecteer klas en cursist(en)."
Resume Exit_cmdAbsentiePerCursistPerPeriode_Click
End Sub
I get a syntax error when pressing the button. Please help...
SeBasTiaan
View 3 Replies
View Related
Sep 9, 2013
I am trying to populate a list box with an event after update in a combo box. I can get the formula to work using 2 criteria, the problem is i nee to add a third criteria. When I try to add it I get the run-time 13 error.
Here is the code I am trying to use:
Private Sub cboStatusRFQ_AfterUpdate()
Me.cboSupplier.RowSource = "SELECT DISTINCT [Consolidated_Master_Req_Pool.RFQ Contact] " & _
"FROM Consolidated_Master_Req_Pool " & _
"WHERE consolidated_master_req_pool.Complete = FALSE AND [Consolidated_Master_Req_Pool.RFQ Supplier] = '" & Nz(cboStatusRFQ.Value) & "'" And "[cosolidated_master_req_pool.Status] = '" & "[SUPPLIER_RFQ FOLLOW-UP]" & "'" & _
"ORDER BY [Consolidated_Master_Req_Pool.RFQ Contact];"
Me.cboSupplier = Null
End Sub
View 2 Replies
View Related
Dec 14, 2006
I have a form, on the form a textbox. Through the expression builder I have assigned one value to the control source of that textbox from a query. The query holds three values, all three of which I would like to use in a separate textbox. When I open the form the textbox just displays #Name. I'm guessing since nothing is happening because the query isn't run by command yet. I've used code like this:
Private Sub AppointmentID_Click()
Forms![ClientsMain]![TechViewSummarySubForm].Form.Requery
Forms![ClientsMain]![TechViewSummarySubForm].Form.Refresh
End Sub
to get a query to open, run etc. But that one is located in a subform which has the query as a control source. How does that work in the case I have now? Can I use the DoCmd function to run the query and get a value from it for the specific textbox? Or can't I use a (segment of a) query as the controlsource of a textbox at all?
I'm asking this since now I calculate and store certain totals by use of a textbox with =Sum() as control source in the footer of a form, which values I then assign to some fields in a table.
But I would also like to learn the right way, using queries, maybe for a later version of my DB when my skills have improved. I've been struggling with this now for a bit, but without succes. So that's why I wonder if I can assign a query or more specific one value of a couple of values in a query to a textbox in a form which has a totally different control source itself.
View 3 Replies
View Related
Aug 20, 2007
Hi all,
I have a select query that pulls in two date values from a textbox on a form.
SELECT DISTINCT Table01.SRV_NAME, Table01.IMP_CUTOFF_DT
FROM Table02 INNER JOIN Table01 ON Table02.Servicer = Table01.SRV_NAME
WHERE (((Table01.IMP_CUTOFF_DT)=[forms]![frmreport].[txtsqldate].[value]))
ORDER BY Table01.SRV_NAME;
However when I run it I get the following error message:"This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may...." but when I copy and paste the value of that txbox from the form into the query it works fine.
Can anyone see where the problem lies? I can't work it out.
Thanks in advance,
Mitch....
View 5 Replies
View Related
Jun 27, 2005
Here's a bit of a pickle I've been trying to wrap my noodle around.
Anyone have an idea what route to pursue (unbound form, or afterupdate, etc?) to force a validation rule on the number of characters in a text box based on the value of combobox in the same form.
Example:
If cboBox1 = 840, then len(txtBox2) = 6
But if cboBox1 = 820, then len(txtBox2) = 3
And so forth?
Thanks,
~Chad
View 5 Replies
View Related
Oct 3, 2006
friends, a small question.
I have placed a txtbox on my form and via a cmdbutton a can copy data to another text box. Is there a way I can replace data? Will appreciate any help.
View 4 Replies
View Related