473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Save Button

Hello,

Can you please help me to figure why is giving me this error: Syntax Error(Missing Operator) in query expression '()'
What I am trying to do is when user clicks Save, the system will firstly remove all bank holidays in the holiday Flatfile table (for selected country) and replace with what's in the list (selected country). Thank you.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim Response
  3.     Dim rstFF As Recordset
  4.     Dim rstAllocated As Recordset
  5.     Dim rstPH As Recordset
  6.     Dim rstEmployee As Recordset
  7.     Dim rstAttend As Recordset
  8.  
  9.     Dim strFF As String
  10.     Dim strAllocated As String
  11.     Dim strPH As String
  12.     Dim strEmployee As String
  13.     Dim strAttend As String
  14.     Dim sSearch As String
  15.  
  16.  
  17.  
  18.     If Me.cboCountry = "BE" Then
  19.  
  20.             'first remove all entries and update with defaults
  21.             strFF = "Select * from tbl_HolidayTracker_Flatfile order by [AttendDate]"
  22.  
  23.             'Debug.Print strFF
  24.  
  25.             Set rstFF = CurrentDb.OpenRecordset(strFF, dbOpenDynaset, dbSeeChanges)
  26.             If rstFF.RecordCount > 0 Then
  27.                 rstFF.MoveLast
  28.                 rstFF.MoveFirst
  29.  
  30.                 While Not rstFF.EOF
  31.  
  32.                     rstFF.Edit
  33.  
  34.                     rstFF![Contr Hrs] = Format(rstEmployee![FTE % hours per day], "0.00")
  35.                     rstFF![SDP Hrs] = Format(rstAllocated![Standard hours per day] * rstAllocated![SDP], "0.00")
  36.                     rstFF![Other Hrs] = Format(rstAllocated![Standard hours per day] * rstAllocated![Other], "0.00")
  37.                     rstFF![Hours] = Format(rstFF![SDP Hrs] + rstFF![Other Hrs], "0.00")
  38.                     rstFF![Activity] = "A"
  39.                     rstFF![%FTE] = rstEmployee![% FTE] * 100
  40.  
  41.                     rstFF.Update
  42.  
  43.                     rstFF.MoveNext
  44.                 Wend
  45.  
  46.             End If
  47.  
  48.             rstFF.Close
  49.             Set rstFF = Nothing
  50.  
  51.             'Now update with new values
  52.             strFF = "Select * from tbl_HolidayTracker_Flatfile where [Location]='" & Me.cboCountry.Column(1, Me.cboCountry.ListIndex) & "'"
  53.             Set rstFF = CurrentDb.OpenRecordset(strFF, dbOpenDynaset, dbSeeChanges)
  54.             If rstFF.RecordCount > 0 Then
  55.                 rstFF.MoveLast
  56.                 rstFF.MoveFirst
  57.  
  58.                 While Not rstFF.EOF
  59.  
  60.                     rstFF.Edit
  61.  
  62.                     rstFF![Contr Hrs] = Format(rstEmployee![FTE % hours per day], "0.00")
  63.                     rstFF![SDP Hrs] = Format(rstAllocated![Standard hours per day] * rstAllocated![SDP], "0.00")
  64.                     rstFF![Other Hrs] = Format(rstAllocated![Standard hours per day] * rstAllocated![Other], "0.00")
  65.                     rstFF![%FTE] = rstEmployee![% FTE] * 100
  66.  
  67.  
  68.                      If Me.cboCountry = "BE" Then
  69.                             If InStr(1, Me.cboCountry, "A") = 1 Then
  70.                                 rstFF![Hours] = Format(DLookup("[Hours]", "tbl_Register_Hours", "[HoursType]='" & Me.cboCountry & "' and [CountryCode]='" & rstEmployee!Location & "'"), "0.00")
  71.                                 rstFF![Activity] = "A"
  72.                             End If
  73.  
  74.                             rstAttend.AddNew
  75.                             rstAttend!EmployeeID = rstEmployee!EmployeeID
  76.                             rstAttend!Attend = Me.cboCountry
  77.                             rstAttend![Date] = rstFF!AttendDate
  78.                             rstAttend.Update
  79.  
  80.                     End If
  81.  
  82.                     rstFF.Update
  83.  
  84.                     rstFF.MoveNext
  85.                 Wend
  86.  
  87.             End If
  88.  
  89.             rstFF.Close
  90.             rstEmployee.Close
  91.             rstAllocated.Close
  92.             rstAttend.Close
  93.             rstPH.Close
  94.     End If
  95.  
  96.  
Jun 19 '18 #1

✓ answered by twinnyfo

Neither have you set rstAllocated to anything. These will both cause such an error to pop up.

Have you included the entire procedure? Or am I missing something?

5 1266
Seth Schrock
2,965 Expert 2GB
On what line do you get this error?
Jun 19 '18 #2
The error message is gone now what I am receiving on line 34 is "Object variable or With block not set.
Jun 19 '18 #3
twinnyfo
3,653 Expert Mod 2GB
I don't see anywhere that you have set rstEmployee to anything. This will throw the described error.
Jun 19 '18 #4
Hello twinnyfo

I know it's missing as rstAllocated, I am trying to simplify this exercise, but it's getting a mess for me. Thank you.
Jun 19 '18 #5
twinnyfo
3,653 Expert Mod 2GB
Neither have you set rstAllocated to anything. These will both cause such an error to pop up.

Have you included the entire procedure? Or am I missing something?
Jun 19 '18 #6

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

Similar topics

3
by: Jack | last post by:
Hi, I am trying to use the following code to make the save button invisible in the asp form when the checkbox is either on or the session variable has a particular value. THE CODE IS AS FOLLOWS:...
5
by: C Watson | last post by:
Hi, I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very specific feature that I would like to use it for. I have a rather long form that the users use to enter data...
3
by: Rick Shaw | last post by:
Hi, can anyone help? I am fairly new to C# and need help with a functionlity in my app. What I need to accomplish is to be able to enable the SAVE button as soon as the user modifies a data in...
2
by: toddw607 | last post by:
Hi all! I am attempting to bring an SQL Server table into ASP.NET using the datagrid . I have set all cells to be a text box by which the user can just click on and edit the cell. I have a...
2
by: Eric | last post by:
Hi, I have a form that requires a save button to be clicked before closing the form. I would like a msgbox to pop up when the button is not clicked before closing. Can someone show me how i...
4
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the...
1
by: QCLee | last post by:
Hello Sir, Im here again asking for help. I have a form and a subform relate to HVAC Windward Table. i have a SAVE button on the form that when clicked it saves data on the HVAC Windward Table but...
14
by: squrel | last post by:
Hello everyone, I m using some button using toolbar such as Add,Save,View,.... my save button is not working.... it doesnt give me any error but does not save to my database.... or showing in my...
1
by: maheshmrk22 | last post by:
Hi, I have a gridview and inside that "select" button in Template column to which i have added command and that handling it in RowCommand Event of grid.. I have added attribute to that button...
1
by: amme | last post by:
i am beginner in MS Access i want to save entries on form(named: MDF) through a save button if form field "Primary Cable" (indexed with other field Primary Cable Pair) have duplicate value then on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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,...
0
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...

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.