473,513 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing Record using value selected in combo box

6 New Member
Hi all,

I'm trying to modify a record (in this case the name associated with the record) to a new name selected by the user in a combo box. Right now I have Single Form with a subform in datasheet view. One of the fields of the subform is a checkbox which allows the user to select which record(s) they want to change the name of. On the single form I have a combo box that allows the user to select the name they want to replace the selected record with.

I think VB is the way to go becuase I've tried Macro's and the setValue option and I have trouble with logic and only modifying the values that have been selected.

I think I want to do something like
Expand|Select|Wrap|Line Numbers
  1.  Inventory.Name WHERE Delete = Forms!Switch_Name!Name; 
Inventory is the table where the records are, and Name is the field I want to update. Delete is the name of the field of the checkbox. I think my methods are right, just my syntax is off. I'm not too sure with VB.

Thanks for all your help!
Jul 13 '07 #1
4 3103
puppydogbuddy
1,923 Recognized Expert Top Contributor
Hi all,

I'm trying to modify a record (in this case the name associated with the record) to a new name selected by the user in a combo box. Right now I have Single Form with a subform in datasheet view. One of the fields of the subform is a checkbox which allows the user to select which record(s) they want to change the name of. On the single form I have a combo box that allows the user to select the name they want to replace the selected record with.

I think VB is the way to go becuase I've tried Macro's and the setValue option and I have trouble with logic and only modifying the values that have been selected.

I think I want to do something like
Expand|Select|Wrap|Line Numbers
  1.  Inventory.Name WHERE Delete = Forms!Switch_Name!Name; 
Inventory is the table where the records are, and Name is the field I want to update. Delete is the name of the field of the checkbox. I think my methods are right, just my syntax is off. I'm not too sure with VB.

Thanks for all your help!
It sounds like you want to delete the checked item, not update it.

Delete * From Inventory Where Inventory.Name = Me!Switch_Name.Form!Name And Delete = True
Jul 13 '07 #2
copewithit
6 New Member
Well if I were to delete the record, then I would be loosing the information. I'm more interested in modifying the checked records, and updating the name field in each one.

The example syntax does help, but I'm still not sure on how to modify a certain field that has been checked in a subform datasheet.
Jul 13 '07 #3
puppydogbuddy
1,923 Recognized Expert Top Contributor
Well if I were to delete the record, then I would be loosing the information. I'm more interested in modifying the checked records, and updating the name field in each one.

The example syntax does help, but I'm still not sure on how to modify a certain field that has been checked in a subform datasheet.

If you want to update (and not delete), try the syntax below, but keep in mind I am assuming that Switch_Name is the name of your subform control on the main form. I used Me to reference your Main form:

Update Inventory Set Inventory.Name = Me!Switch_Name.Form!Name Where Delete = True
Jul 13 '07 #4
copewithit
6 New Member
Thanks! The SQL Update command really helped. A quick note, if you want to update more then one field you just use a coma inbetween update expressions. Thanks again!
Jul 13 '07 #5

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

Similar topics

2
4620
by: Bobbak | last post by:
Hello All, I am have created this form that allows the user to Add/Edit an Employees info. In it I have several Combo Boxes that forces the user to select one of the options containned in the...
4
4726
by: Skully Matjas | last post by:
I am using the following code (created by the wizard) to allow to bring my form to a particular entery. But when I edit the entery (ex: put new information into a blank cell), it puts that record...
1
1638
by: Kevin Myers | last post by:
Hello, I have a form that contains several sub-forms corresponding to tables which are conceptually children of the main table for the form. On this form, I need to have a button that allows...
8
12066
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
3
3199
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data....
7
9807
by: Harris | last post by:
Dear all, I have the following codes: ====== public enum Enum_Value { Value0 = 0, Value1 = 10,
0
1643
by: uthooker | last post by:
I have an Access form with some combo boxes in the Form Header that are enabled/disabled using conditional formatting based on the setting in a checkbox also in the Header (Combo box = Enabled by...
2
1350
by: ringer | last post by:
I use a combo box to select a value from a list but I don't want what is selected to be written to the record. I need each selection of the combo box to correspond to another value that should be...
6
2300
by: MyWaterloo | last post by:
''''''''''''''''''''''''''''''''''''''''''' ' The AfterUpdate event procedure used in ' ' the Find Customer combo box search. ' ''''''''''''''''''''''''''''''''''''''''''' 'Moves to...
0
7160
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
7384
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,...
1
7099
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
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
5685
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
5086
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
4746
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...
0
3233
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
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.