HELP! Query not accepting input from sub form

Jimg1976

Registered User.
Local time
Today, 16:45
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:
 
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
 
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!
 
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.
 
SO the error I get is the same
Enter Parameter Value
Then this
Forms!frm_employeelookup.sfrm_employeelookup.Form!Badge
 
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:
 
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...
 
That is weird. That was a typo as I tried to copy the error message instead of copying and pasting
 
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.
 
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

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

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: 139
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.
 
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

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?
 
Hello There theDBguy,

That second file works fine. Thank you very much! Now, is it possible to explain the issue?
 
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.
 
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
 
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.
 
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

Back
Top Bottom