Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Referencing the combo box in the subform?

Posted on 2012-03-19
8
Medium Priority
?
533 Views
Last Modified: 2012-03-19
I am trying to requery for the combo box in another form.

I have two forms.
frmPublication/frmqryAffiliatiion_subform
frmAuthor

When I adda new record in the frmAuthor, I want to requery the combo box in the subform of the frmPublication.

I don't see the control name for the combo box in the subform.
It is tied to the AuthorID so I am using the AuthorID as the controlID.

The subform has several textboxes to display the fields. I converted the textbox to a combo box.


How can I reference the combo box of subform in another form?

There is no field named "Forms!frmPublication.[frmqryAffiliation subform].Form.AuthorID in the current record.
0
Comment
Question by:dkim18
  • 4
  • 3
8 Comments
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 2000 total points
ID: 37737512
Your syntax looks okay - I think you just need the correct name for your combo.

- Open your subform in design view
- Right click on your combo box and select 'Properties'
- Under the tab labeled 'Other', look for the Name property of your combo

That is the name that you should use in your syntax:


Forms!frmPublication.[frmqryAffiliation subform].Form.YourComboName
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 37737561
On another note, the "subform name" should be the name of the subform control - which may be different from the name of the subform as it appears in the database window or navigation pane.

You can find the correct name by
- opening your main form in design view
- Right-clicking on the edge of the subform and selecting properties, and checking the Name property
0
 

Author Comment

by:dkim18
ID: 37737565
I have it as AuthorID.
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 61

Expert Comment

by:mbizup
ID: 37737576
Can you upload a sample copy of your database, with any sensitive data removed?
0
 

Author Comment

by:dkim18
ID: 37737586
I check the subform name too, frmqryAffiliation Subform.
It is same.
0
 
LVL 40

Expert Comment

by:als315
ID: 37737657
Create empty query, use builder to select your field (start from main form, then select subform), copy full name of field from query builder to VBA code
0
 

Author Comment

by:dkim18
ID: 37737662
OK. I got it fixed.

I used the macro to requery.
It was giving me that errror.

I changed it to the event code and it is working fine.

Why would macro error out though?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37737677
I ran into siomething similar in another question recently.

In that case it turned out to be a timing issue -- the Macro was getting executed before the subform was actually loaded.

With VBA, the timing of form/subform events is a lot more clear-cut.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question