473,396 Members | 2,033 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,396 software developers and data experts.

SQL Query with form elements

255 100+
Hi guys,

I'm having a problem with a subform, it runs a query that contained an element from the main form (a recordset) used for parameter. When the main form takes a date parameter, the AfterUpdate event only runs the following line of code:
Expand|Select|Wrap|Line Numbers
  1. AttendanceSub.Requery
and below is the query AttendanceSub
Expand|Select|Wrap|Line Numbers
  1. SELECT Attendance.Date
  2. , Attendance.EmployeeNo
  3. , Attendance.ChristianName
  4. , Attendance.Surname
  5. , Attendance.Area
  6. , Attendance.Shift
  7. , Attendance.Duties
  8. , Attendance.RosterCode
  9. , Attendance.Attendance
  10. , Attendance.ManfHours
  11. , Attendance.WhouseHours
  12. , Attendance.[Other Hrs]
  13. , Attendance.Comments
  14. , Attendance.Observe
  15. , Attendance.absenceHours
  16. FROM Attendance
  17. WHERE 
  18. (
  19. (Attendance.Date)>=[forms]![AddWeekRec]![WSDate] 
  20. And (Attendance.Date)<=DateAdd("d",[forms]![AddWeekRec]![Days]-1,[forms]![AddWeekRec]![WSDate])
  21. )
  22. ORDER BY (Attendance.Date);
  23.  
After it executes, the subform should list the records with the entered date from the main form. The problem is the list won't showed up. It was still working when I use it to test something last month, but now it doesn't including the previous backup versions. The subform also includes "EmployeeNo" in both link child fields and link master fields, where "EmployeeNo" is a field from the main form, source object is the query AttendanceSub.

Can anyone tell me is it the coding error? or some property setting in the form need to be make? Thanks.
Jun 25 '10 #1

✓ answered by colintis

I found the problem....its actually there's a corruption in the database itself. After I do the Compact and Repair Database everything just work back as normal. :)

Thanks for the advice Jim, for leading me to find the error message which lead to the solution ;D

7 2601
jimatqsi
1,271 Expert 1GB
Hmm, I don't see anything obvious. A few things you might try:
instead of AttendanceSub.Requery, try me.requery to see if the result is any different.

Copy the query to a new, temporary name and run while that form is open with the changed date and see what the query returns. If it is empty, go into design mode and study what you see there. The answer should show up, or at least an answer that can lead you to another question.

Study filtering forms and consider whether that is a better solution for you. I always seem to run into problems when I try to use form data within a saved query. See these posts for info about that:
http://bytes.com/topic/access/answer...d-filters-form
http://bytes.com/topic/access/insigh...filtering-form

Jim
Jun 28 '10 #2
colintis
255 100+
@jimatqsi
Hi Jim,

A little deeper checking, the subform in the main form is also called AttendanceSub, so I think the code in the main form is calling the subform to do the requery.

The setting in this subform has query attendanceSub as record source, order by the date field in the query. It also set to yes for both allow filters and edits, no locks and fetch defaults.

I tried executing the copied query while the form is opened, it did returns the records within the date range. But when I tried to list a specific person (using EmployeeNo), a pop-up appears with a message : Record is deleted.

Also the 2 links you put at the end said they were removed already...
Jun 28 '10 #3
colintis
255 100+
I found the problem....its actually there's a corruption in the database itself. After I do the Compact and Repair Database everything just work back as normal. :)

Thanks for the advice Jim, for leading me to find the error message which lead to the solution ;D
Jun 29 '10 #4
jimatqsi
1,271 Expert 1GB
So how can it be that these records are being deleted? Not knowing anything about your DB or processes, I can't offer anything about that. But it sounds like you are looking for data that is no longer there, so I would ask "should it still be there? If it is, where is it? If it's not, why not? Sounds like you have a lot of digging to do to see what's really going on.

I don't understand what's up with those links ... posts stay on the site for years. Maybe they got moved to an archive area.

Jim
Jun 29 '10 #5
colintis
255 100+
@jimatqsi
The data records are there, i scroll through the table and its there, the question becomes: "Why the error said the record is deleted while the data is still in the table?".

During the time i scroll through the table, i also found a few records' fields are all written as #DELETE, that might be data corruption. There's also a M$ Support page mentioned that when I google the error message. And yeah, after I compacted the database I can then get the required output.

But then another problem has shown up for data type, and that's another topic's problem...
Jun 29 '10 #6
NeoPa
32,556 Expert Mod 16PB
Jim,

The problem with the links seems to be that you copied and pasted only the snipped display of previous links. I tried to fix them for you, but found there was nothing in there to show where you'd intended to link to. Sorry.
Jun 29 '10 #7
NeoPa
32,556 Expert Mod 16PB
colintis: The data records are there, i scroll through the table and its there, the question becomes: "Why the error said the record is deleted while the data is still in the table?".
I would read that as a corrupted index. Indices get rebuilt from the existing data when a repair is done so you'd expect that to get fixed.
Jun 29 '10 #8

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

Similar topics

13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
5
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the...
1
by: Howard Jess | last post by:
Apparently, form elements of type <input type="image" src="...> are not included in the form's elements collection. I don't understand why not; according to DOM2, all form control elements...
4
by: WindAndWaves | last post by:
Hi Gurus I have the following statement in my code: var e = form.elements; Is it possible to put any conditions on this statement. What I actually want to say is: var e = form.elements...
5
by: Dani | last post by:
Hello everybody, I have some code that disables form elements on body load, but I notice when I hit the "back" button, I need to re-enable the form elements (that is done by clicking on a radial...
12
by: Pudlik, Szymon | last post by:
Hi, I've written some code: function onSubmit(form){ for (var i = 0; i < form.elements.lenght; i++){ if (form.elements.disabled == 1) form.elements.disabled = 0; }
2
by: jingalls | last post by:
I'm trying to modify a form so that when a user clicks a checkbox for a shorter version of the form, it will replace swap the default (long) form elements with the short version of elements, so...
2
by: Andy Johns | last post by:
I've seen plenty of examples of file uploads in ASP.NET when the only form element is the file input type, but I've not seen a practical example of a file upload routine running alongside other...
25
by: Dave | last post by:
Hello. In trying to get an anchor element to stylistically match an input or button element, I find that the button and input cannot be styled according to the 2.1 CSS spec. For example, I...
2
by: mars123 | last post by:
hi, I am facing a js error in my code, below is the prob. statement I have a radio2 javascript function as below, it works like this.. When a parent radio button is selected only one of its...
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
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...
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
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.