473,513 Members | 2,469 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 1751
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
11016
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...
8
3328
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...
5
14527
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...
6
1875
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...
32
3636
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...
5
6319
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...
1
2664
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...
2
6943
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...
17
2369
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
2512
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...
0
7259
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,...
0
7158
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...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5085
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...
0
3232
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...
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
455
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...

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.