HELP! Query not accepting input from sub form (1 Viewer)

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
Ok, I have a query that is executed when a field is double clicked in a subform

Here is the query

SELECT tbl_incident.Date_of_Incident, tbl_incident.Badge, tbl_incident.Description, tbl_incident.Code, tbl_incident.Comment, tbl_incident.Points, tbl_incident.Drop INTO tbl_previous
FROM tbl_incident
WHERE (((tbl_incident.Badge)=[Forms]![frm_employeelookup]![sfrm_employeelookup]![Badge]))
GROUP BY tbl_incident.Badge, tbl_incident.Date_of_Incident, tbl_incident.Description, tbl_incident.Code, tbl_incident.Comment, tbl_incident.Points, tbl_incident.Drop;

Now this worked perfectly until..... I deleted a form Called Main Screen, Main screen had 2 buttons. 1. to open a form called add incident. The other button opened a form called Employee lookup.

This employee lookup form is where the subform is located. However since I deleted that Main Screen form, when I double click the subform Employee Info it keeps asking for a parameter value. I have no idea what to do.

I have tried rebuilding the Where statement, several times and that has not helped.

Any suggestions?:banghead:
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
Hi. Is that the query syntax that used to work? Because, it seems the syntax for the WHERE clause is maybe a little off. What did the parameter prompt say? To refer to a control on a subform, the syntax should be similar to this:
Code:
Forms!MainFormName.SubformName.[b]Form![/b]ControlName
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
Well hello my friend. It says Parameter and shows that line of the query. Yes that syntax worked fine before. That is the strange part. I will try what you suggest and let you know. Thanks again. You are quite the help!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
Well hello my friend. It says Parameter and shows that line of the query. Yes that syntax worked fine before. That is the strange part. I will try what you suggest and let you know. Thanks again. You are quite the help!
Understandable. When you move forms around, it affects parameter queries because they can only resolve absolute references. So, if a form moves from one subform to another, the reference could have changed.
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
SO the error I get is the same
Enter Parameter Value
Then this
Forms!frm_employeelookup.sfrm_employeelookup.Form!Badge
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
Understandable. When you move forms around, it affects parameter queries because they can only resolve absolute references. So, if a form moves from one subform to another, the reference could have changed.

That is understandable, however the form I removed was not in anyway attached to the subform. All it did was open the main form the subform is located on. It did not pass data or anything, this is why I am so confused. I guess this is what I get for listening to the boss on changing things HA:eek:
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
SO the error I get is the same
Enter Parameter Value
Then this
Forms!frm_employeelookup.sfrm_employeelookup.Form!Badge
Hi. In your post, there's a space before Badge. I hope it's just a typo. The sfrm_employeelookup part has to be the name of the subform container on the main form - not the name of the form it contains. If that doesn't make sense to you, would you consider posting a sample copy of your db, so we can help you identify the names and syntax you're supposed to use? Thanks...
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
That is weird. That was a typo as I tried to copy the error message instead of copying and pasting
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
That is weird. That was a typo as I tried to copy the error message instead of copying and pasting
Hi. Perhaps even just some screenshots of your forms in design view might help us help you.
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
Ok here is a zip file with the database in it. The issue is the previous incident query. When you open the Employee Lookup form, and double click on the Badge column for any entry you will see the error. Thanks again. I can't tell you how much this helps. You have been very helpful now for the second time!
 

Attachments

  • Rolling Attendace.zip
    322 KB · Views: 109

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
Ok here is a zip file with the database in it. The issue is the previous incident query. When you open the Employee Lookup form, and double click on the Badge column for any entry you will see the error. Thanks again. I can't tell you how much this helps. You have been very helpful now for the second time!
Hi. Thanks for posting a copy of your db. It makes it quicker to find a solution when we can check out the problem first hand. Please take a look at the attached and let me know if it's doing what you wanted. Then, I can explain what I did. Otherwise, I'll have to try again.
 

Attachments

  • Rolling Attendace.zip
    83.1 KB · Views: 111

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
It is giving me the same error. I have attached a screen shot of what I am seeing.
 

Attachments

  • error2.PNG
    error2.PNG
    37.8 KB · Views: 107

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
What I am trying to do, is double click on the badge field in the sub form, you will see the macro that runs the queries, all off which reference that Badge field. As of today I am seeing this same pop up no matter what I do. This started when I deleted that Main Form screen. All that Main form did was open that Employee Lookup for, or Open the Add Employee Form.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
It is giving me the same error. I have attached a screen shot of what I am seeing.
Hi. What do you mean? Unless the forum software is wrong, I don't see anyone has downloaded the file I posted above. In case I posted the wrong file, I am reposting it now. Please try this one again and let me know if you still get an error. When I open frm_employeelookup and then double-click on the badge textbox, I am not getting any errors.
 

Attachments

  • Rolling Attendace.zip
    94.1 KB · Views: 111

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
What I am trying to do, is double click on the badge field in the sub form, you will see the macro that runs the queries, all off which reference that Badge field. As of today I am seeing this same pop up no matter what I do. This started when I deleted that Main Form screen. All that Main form did was open that Employee Lookup for, or Open the Add Employee Form.
Hi. Are you available for a quick screen share session?
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
Hello There theDBguy,

That second file works fine. Thank you very much! Now, is it possible to explain the issue?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:43
Joined
Oct 29, 2018
Messages
21,575
Hello There theDBguy,

That second file works fine. Thank you very much! Now, is it possible to explain the issue?
Okay, that was a relief. Okay, what I had to do was create a new frm_employeelookup form for you. You'll see the old form renamed as bad_frm_employeelookup. I think it might be corrupted. Your syntax was correct, so I think it turns out to be the form that was bad in this case.
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
I can not thank you enough theDBguy, if I could do more than push that thanks button I would! You are a a life saver
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:43
Joined
Sep 12, 2006
Messages
15,726
have a look in the query properties. (right click the design pane) There is probably a residual sort order or similar referencing the old name.

aah - I see you have already been assisted.
 

Jimg1976

Registered User.
Local time
Today, 11:43
Joined
Apr 17, 2019
Messages
47
have a look in the query properties. (right click the design pane) There is probably a residual sort order or similar referencing the old name.

aah - I see you have already been assisted.


I have but thank you very much. Very new to Access Programming and this forum and theDBguy have been a great help!
 

Users who are viewing this thread

Top Bottom