Combo box issue

M

myseven123

I am trying to requery a field on a subform after adding a new item to a
combo box. I keep getting a 'debug' error after this line is executed:

Me!PackageSender.Requery

Now I used this same type of solution on the main form and there were no
problems.

I think it has something to do with the fact that this is a subform. Can
anyone help?
Thank you,
Laura
 
J

Jeff Boyce

"How" are you trying to requery the field in the subform?

Since a subform is embedded within a main form, your expression needs to
take that into account. Untested:

Forms!YourMainForm!YourSubformControl.Form!YourFieldInSubform.Requery

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

myseven123

Using the 'AfterUpdate' event

Jeff Boyce said:
"How" are you trying to requery the field in the subform?

Since a subform is embedded within a main form, your expression needs to
take that into account. Untested:

Forms!YourMainForm!YourSubformControl.Form!YourFieldInSubform.Requery

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Jeff Boyce

That's "where" you are trying to do it.

"How"? (i.e., what code/expression?)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

myseven123

I apologize for misunderstanding your question. Let me try to explain (I am
not very good at this).

Basically I tried to create a self-referential combo box that lists all the
unique sender names the user type's into the field.

I have 2 forms a main form and a subform. I want to do the requery on a
field in the subform.

To do this I created a query that lists unique sender names and then used
that query as the combo box's row source property on my main form's subform.
Then to make sure the list kept up with the new entry I tried to requery
through the form's AfterInsert (I was mistaken earlier by saying AfterUpdate)
event.

I tried this code: Me.PackageSender.Requery

but quickly realized...I probably have to make an adjustment because of the
subform.

So I tried this:

Forms!PackageForm!PackageSubform.Form!PackageSender.Requery

But it still did not work. I know whatever is wrong is just stupid on my
part...I am just a novice when it comes to Access.

Thanks,
Laura
 
M

myseven123

Although, I believe we probably mean the same thing when speaking of
“self-referential combobox†I don’t think I was clear in explaining myself. I
am not looking to create more or unnecessary code for my database but rather
troubleshoot an error I am experiencing.

I know I did the code for the “self-referential combobox†correctly because
my first database is working and complete with no problems. What I am not
sure...is why I am having problems with this one. Can you answer me this? “Do
you understand what I am trying to accomplish? And if you do…“is there
something I can do to fix it? Is the cause of my problem the subform and is
this why I am experiencing an error? Or are these just the wrong questions to
ask?

I really need more specific feedback so I apologize for being short with
you. This is the third time I have asked for help on this forum (for
unrelated issues) and I don't seem to be very successful at obtaining any
answers. I have read and reread everything and anything on Access 2003 help.
All of these lead me to another menu with another explanation but none led me
to answers to my specific questions.

Thank you,
Laura
 
J

Jeff Boyce

I don't understand what you are trying to do.

(... and consider that if you post an issue to these newsgroups, folks here
might have a different -- maybe more efficient, maybe not -- way of
accomplishing what you're after...)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

myseven123

Ok, thank you for your patience and help. I will have to get back to this
sometime next week when I can't put more time into it.

Have a nice weekend,
Laura
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top