473,671 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing field value

24 New Member
Hey Guys,

Hopefully there is a simple answer to this question. Currently on my form I have a combo box [cboStatus]. The selection from the combo box is open, close, review etc. Once the selection is made from the combo box it assigns it to the account and insert the information in another table. The users do have access to the accounts on the form by a filter. I am using the Docmd.Run my Sql function to insert the information into the table. The question I have is if I wanted to change the status of the account from review to close, how can that be done? I thought by choosing a different status from the combo box [cboStatus] it would change it but it does not. Any information you guys can provide would be great. Thanks for all the help.
Jan 15 '07 #1
5 1758
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hey Guys,

Hopefully there is a simple answer to this question. Currently on my form I have a combo box [cboStatus]. The selection from the combo box is open, close, review etc. Once the selection is made from the combo box it assigns it to the account and insert the information in another table.
How is this achieved. Is the control source of cboStatus set to the relevant field and what do you mean by another table?

Mary
Jan 15 '07 #2
Umoja
24 New Member
Hi mmccarthy,

Sorry for not explaining everything clearly. The control source of cboStatus is not set to the relevant field. This is how I have everything setup. The source for the form is a query [Custdetail]. The source for this query is the main table [Tblcustinfo] which contains all the fields. One of those fields is a text field called [CS], by default this field is set to N. Once a selection is made from the combo box [cboStatus], the cust#, CustName, AcctBal and the combo box selection is inserted into table [TblStaffAct]. In this table there is a field called Activity which is where is the combo box selection is inserted.
In query [Custdetail] there is a relationship between the main table [Tblcustinfo] and table [TblStaffAct]. The [CS] field and the [Activity] are included in the query and is displayed on the form. When a selection is made from the combo box the activity is displayed on the account and the [CS] field changes from N to Y. The code below is how I have programmed the combo box.

Expand|Select|Wrap|Line Numbers
  1. mySQL = "INSERT INTO TblStaffAct ([Cust#], CustName, Acctbal, cboStatus) 
  2. Select [forms]![CustMain]![Cust#] as a, 
  3.           [forms]![ CustMain]![CustName] as b, 
  4.           [forms]![ CustMain]![Acctbal] as c, 
  5.           [forms]![ CustMain]![cboStatus] as d;"
  6. DoCmd.RunSQL mySQL
Hope this is more clearly. Thank you for helping me out again :)!
Jan 15 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
There are a couple of issues here. Firstly, you are inserting a new record in a table that is part of the query that is the record source for the form. Firstly, you will have to requery the form after the insert to update the record using:

Expand|Select|Wrap|Line Numbers
  1. Me.Requery
The other issue I have with this is that there can only be a one to one relationship between the two tables. If there are two records in the second table with a relationship to the first table this will create two records returned by the query.

Next there seems to be a problem with the insert query in that you have a space before the form name CustMain in three of the references. I would redesign it anyway as follows:

Expand|Select|Wrap|Line Numbers
  1. mySQL = "INSERT INTO TblStaffAct ([Cust#], CustName, Acctbal, cboStatus) VALUES (" & Me.[Cust#] & ",'" & Me.[CustName] "'," & Me.[Acctbal] & ",'" & Me.[cboStatus] & ");"
  2. DoCmd.RunSQL mySQL
This assumes Cust# and Acctbal are numbers/currancy while the other two are text datatypes.

Mary
Jan 17 '07 #4
Umoja
24 New Member
Thank you, mmccarthy I made a few changes and I was able to get it to work.
Jan 22 '07 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
Thank you, mmccarthy I made a few changes and I was able to get it to work.
That's great, glad to hear it.

Mary
Jan 22 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
11038
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic SFSB and, from there, to the database. On the front end, all cells appear as text fields. However, for certain cells, when the user clicks on the cell, the text field turns into a drop-down field (i.e. Select object), defaulting to the value...
8
3354
by: horos | last post by:
hey all, Ok, a related question to my previous one on data dumpers for postscript. In the process of putting a form together, I'm using a lot of placeholder variables that I really don't care about in the submitted action. I'd therefore like to get rid of them by doing something like:
5
14538
by: Good Man | last post by:
Hi there I'm adding form fields on the fly with some javascript DOM programming. I basically just clone a hidden <div>, then adjust node properties to make this new <div> have unique values (style, size, etc.) the original code of the input tag is: <input type="file" onchange="alert('original')" size="30" id="filea" name="filea">
6
1883
by: John Baker | last post by:
HI: I have a situation where I wish to enter a value in an unbound field on a form and then change the same field in each record on the form so that it reflects the value entered. THe form is suppored by an updatable query (linked to a table). I would rather not use a query approach because it will result in a need for a new form and will create its own complications (although this could be done) I would like to make the change so that it...
32
3668
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's RecordSource like this? Am I asking for trouble doing this with a memo field? Thanks in advance. Private Sub cmdNextNote_Click() Dim lngNid As Long If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
5
6346
by: Nonoize | last post by:
Hi all, Really dumb question but I don't know how to resolve it. Looked in help and evry book I have. I have a table where the primary key was set as an Integer and its reached over 140K worth of records and the numbering has restarted from 1. I realize now that I should have set it to double. Can someone please advise how I can save my existing records and restart the numbering from say
1
2677
by: mplus_2000 | last post by:
I have recently inherited a database. The switchboard (and other forms) displays the name of the database on it (top, center). Currently the name that appears is Reviews. There are plans to roll out the application (i.e. making copies of the database) to other locations (Reviews-NY, Review-Dallas etc). If was mentioned today in passing by the original developer that there is a way to change the title that appears on the switchboard without...
2
6974
by: John | last post by:
Hi Everyone, I have a question about dynamically changing the length of a varchar(n) field, in case the value I'm trying to insert is too big and will give a "truncated" error, but before the error is given! i.e. Is there some kind of a way to "test" the length of the field while Inserting the value into it, and to have it automatically increase its length to the length of the value being inserted, in case the value is too big? I've...
17
2383
by: blufox | last post by:
Hi All, Can i change the execution path of methods in my process at runtime? e.g a()->b()->c()->d()->e() Now, i want execution to be altered at runtime as -
1
2518
by: jsaps33 | last post by:
Hi All, I'm wondering how I would change an initial value to a blank value if nothing gets entered into the text field. I have a form with multiple fields that visitors can enter data in to get the search results they want. For example right now I have this, <input id="IDX-text_landArea" name="kw_landArea" maxlength="255" type="text" onfocus="if (value == 'Lot Size') {value =''}" onsubmit="if (value == 'Lot Size') {value = ''}"...
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6223
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5695
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4224
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.