473,695 Members | 3,037 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy Command using Cascading Combo Boxes in a Subform

1 New Member
I am building a database to track attendance. I have one main form with multiple subforms. Within one of the subforms name sfrDailyAttenda nce, I also have cascading combo boxes (cboCategory and cboException) to filter difference absences (ie.Regular, Overtime, etc). cboCategory is filtered as follows:

[Forms]![frmMain]![sfrDailyAttenda nce].[Form].[Category].

Because I have the subform set up as a continuous form, I needed to add a text box (txtException) on top of one of the combo boxes (cboException), so that when a new Category was selected, it did not reset previous Exceptions selected. tblDailyAttenda nce does not have a field called txtException, which I thought was the reason, however, when I added it in the table, I still received errors.

The copy button is used to increment the date if it a consecutive absence for the same reason, and have been given advice to add the following code:

strSQL = "INSERT INTO tblDailyAttenda nce (StartTime, EndTime, Category, Exception, " & _
"Reason, ExceptionHrs) "
strSQL = strSQL & "VALUES(#" & Me.Date + 1
strSQL = strSQL & "#,#" & Me.StartTime & "#,#" & Me.EndTime & "#," & Me.Category & _
"," & Me.Exception & "," & Me.Reason & "," & Me.ExceptionHrs & ", " & Me.Description & ");"
CurrentDb.Execu te strSQL

DoCmd.RunComman d acCmdRecordsGoT oLast

Everything seems to be populating correctly when I step through the code, however, I get "Syntax error (missing operator) in query expression 'Paid OT'" Paid OT is a value populated in the cboException, which also appears in txtException. I'm thinking that I need to add a WHERE clause, but not sure

Any additional assistance would be great. Thanks
Aug 17 '07 #1
2 2282
JConsulting
603 Recognized Expert Contributor
I am building a database to track attendance. I have one main form with multiple subforms. Within one of the subforms name sfrDailyAttenda nce, I also have cascading combo boxes (cboCategory and cboException) to filter difference absences (ie.Regular, Overtime, etc). cboCategory is filtered as follows:

[Forms]![frmMain]![sfrDailyAttenda nce].[Form].[Category].

Because I have the subform set up as a continuous form, I needed to add a text box (txtException) on top of one of the combo boxes (cboException), so that when a new Category was selected, it did not reset previous Exceptions selected. tblDailyAttenda nce does not have a field called txtException, which I thought was the reason, however, when I added it in the table, I still received errors.

The copy button is used to increment the date if it a consecutive absence for the same reason, and have been given advice to add the following code:

strSQL = "INSERT INTO tblDailyAttenda nce (StartTime, EndTime, Category, Exception, " & _
"Reason, ExceptionHrs) "
strSQL = strSQL & "VALUES(#" & Me.Date + 1
strSQL = strSQL & "#,#" & Me.StartTime & "#,#" & Me.EndTime & "#," & Me.Category & _
"," & Me.Exception & "," & Me.Reason & "," & Me.ExceptionHrs & ", " & Me.Description & ");"
CurrentDb.Execu te strSQL

DoCmd.RunComman d acCmdRecordsGoT oLast

Everything seems to be populating correctly when I step through the code, however, I get "Syntax error (missing operator) in query expression 'Paid OT'" Paid OT is a value populated in the cboException, which also appears in txtException. I'm thinking that I need to add a WHERE clause, but not sure

Any additional assistance would be great. Thanks
This sounds pretty simple. When you insert a text value using the code above, the proper format is

'" & me.somevalue & "'

let me break it out so you can see it better

' " & me.somevalue & " '

where the tick marks go outside the quotes.

J
Aug 18 '07 #2
JConsulting
603 Recognized Expert Contributor
I am building a database to track attendance. I have one main form with multiple subforms. Within one of the subforms name sfrDailyAttenda nce, I also have cascading combo boxes (cboCategory and cboException) to filter difference absences (ie.Regular, Overtime, etc). cboCategory is filtered as follows:

[Forms]![frmMain]![sfrDailyAttenda nce].[Form].[Category].

Because I have the subform set up as a continuous form, I needed to add a text box (txtException) on top of one of the combo boxes (cboException), so that when a new Category was selected, it did not reset previous Exceptions selected. tblDailyAttenda nce does not have a field called txtException, which I thought was the reason, however, when I added it in the table, I still received errors.

The copy button is used to increment the date if it a consecutive absence for the same reason, and have been given advice to add the following code:

strSQL = "INSERT INTO tblDailyAttenda nce (StartTime, EndTime, Category, Exception, " & _
"Reason, ExceptionHrs) "
strSQL = strSQL & "VALUES(#" & Me.Date + 1
strSQL = strSQL & "#,#" & Me.StartTime & "#,#" & Me.EndTime & "#," & Me.Category & _
"," & Me.Exception & "," & Me.Reason & "," & Me.ExceptionHrs & ", " & Me.Description & ");"
CurrentDb.Execu te strSQL

DoCmd.RunComman d acCmdRecordsGoT oLast

Everything seems to be populating correctly when I step through the code, however, I get "Syntax error (missing operator) in query expression 'Paid OT'" Paid OT is a value populated in the cboException, which also appears in txtException. I'm thinking that I need to add a WHERE clause, but not sure

Any additional assistance would be great. Thanks


as far as the where part...you want to insert the record into a specific person's records..you'll probably want to use

Where ID = " & me.ID & "

where the ID number corresponds to the ID field you use in the table.

J
Aug 18 '07 #3

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

Similar topics

2
3319
by: Cameron | last post by:
Hi, For the database I am currently working on, my employer would like the ability to use multiple combo boxes in order to filter the database. For instance the structure of the company is based on regions, which are managed by a number of coordinators, who oversee a large group of associates. I would like to use a combo box so that people accessing the database can choose a particular region and then have a second combo box that only...
14
4967
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
3
5341
by: Mike Jakes | last post by:
I hope that someone can offer a little advice on this one - I've searched the group but can't find an answer. I think that I'm doing something really stupid or missing something trivial, but see what you can make of this... I have a main form "Events" that contains a tab control. The tab control has 7 pages. The 7th page (named "Boats") contains a subform called "BoatEventssubform". On this sub-form are two combo boxes, named...
9
15841
by: natwong | last post by:
Hi All, I'm a newbie in terms of Access and some of its functionality . I've been stuck on this problem for a couple days, even after searching the Web, etc. Currently I have five combo boxes (actually list boxes) that are multiselects in my main form. I need to use these combo boxes to filter a subform within my main form. My combo boxes are as follows: 1. A - 4 select options 2. B - 10 select options 3. C - 4 select options
4
3489
klarae99
by: klarae99 | last post by:
Hello, I am working on an Access 2003 Database. The tables that pertain to this issue are tblOrg, tblState, tblCity, and tblZip. I have posted the table structure with only the pertinant fields below. tblOrg OrgID, AutoNumber, PK ZipID, Number, FK tblState StateID, AutoNumber, PK
3
3980
kcdoell
by: kcdoell | last post by:
I have 5 cascading combo boxes on a form. Below is a sample of my vb in the first combo box: Private Sub CboDivision_AfterUpdate() 'When the Division is selected, the appropriate Segment list will 'display in the drop down list of CboSegment With Me! If IsNull(Me!cboDivision) Then
5
4898
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect the State chosen by only showing cities in that selected state. 4. When I open just the subform it works just fine but when I open the
1
1679
by: bluclouds9 | last post by:
I am new to Access and have been charged with creating a database for our course alumni. I currently have a "Contacts" form and am trying to create a subform to hold the course alumni information. I would like the first combo box to contain the course and the second to show the approriate years. Everything seems to be working except the years are not showing in the second combo box. My tables are set up as: CourseNames CourseID...
20
4131
by: luciegiles | last post by:
Hi, I have used the tutorial Cascading Combo/List Boxes to filter the combo box cboCareManager dependent on the entry to cboLocalityTeam - the common code between the two tables is LocalityCode. cboCareManager and cboLocalityTeam both sit within frmSub which in turn is a subform within frmMain. The AfterUpdate code is as follows: Private Sub cboLocalityTeam_AfterUpdate() With Me! If IsNull(Me!cboLocalityTeam) Then .RowSource...
0
9112
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8971
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
8824
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8817
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7651
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4336
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
4571
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2994
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 we have to send another system
3
1970
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.