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

Microsoft Access can't set the LimitToList property to No right now.

Hi all,

I am making a new database with a data entry form as standard. One of my tables is tblFile which is where the entered data will fill. Another table I have is tblLocation, which is a list of Locations where the files have come from.

On my data entry form for new records to the tblFile, I have a combobox that uses the tblLocation fields (LocationID as a primary key and FileLocation as the name of the location) as a row source to populate the control source of LocationID in tblFile. When users will enter new records, they may need to add a new location so I want to set the LimitToList property to No. However, the error message below comes up:

"Microsoft Access can't set the LimitToList property to No right now. The first visible column, which is determined by the ColumnWidths property, isn't equal to the bound column. Adjust the ColumnWidths property first, and then set the LimitToList property."

Essentially is there a way for the user to enter a location (e.g. London) and if it is not in the list add a new record to the tblLocation and then update the new record in the tblFile?

Many thanks in advance!
Jan 6 '15 #1
8 4830
Seth Schrock
2,965 Expert 2GB
I have come up with a fancy way of doing just that. First, you will need to create a form that is bound to tblLocation, has a close button, and has its Modal property set to Yes. Then, in your Row Source property for the combo box, make it a UNION query, like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT LocationID, FileLocation FROM tblLocation
  2. UNION
  3. SELECT 0, "<Other>" FROM tblLocation
  4.  
Now, create an After_Update event for your combobox that checks if the value equals 0, then open the form you created as a dialog box then requery your combobox, and then set the value to whatever value is in the global variable that you populated in the next step. In frmLocation's close button Click event, set the value that you just entered into a global variable and then close the form. Because frmLocation is Modal and opened as a dialog box, the code in your combobox's AfterUpdate event won't continue until the form closes.
Jan 6 '15 #2
Wow, thanks for the quick response. I'm still a novice with all this stuff so can I make a step by step style list and get you to check it before I give it a go?

1. Create a new blank form bound to tblLocation and set its modal property to yes - what do I put on the form? is it blank?
2. Change the Row Source property of the combobox on the data entry form to the union query you stated above - I don't quite understand the select 0 line though!
3. After_Update event of combobox to something like
Expand|Select|Wrap|Line Numbers
  1. If Me.value = 0 Then DoCmd.OpenForm(Newform)
4. What do you do once you've opened the form? Does it get populated by the combobox somehow?
5. Requery the combobox - how do you do this?
6. "Set the value to whatever value is in the global variable that you populated in the next step" - this is populated by the new form?
7. Change the close button click event to populate the global variable and then close

So does this add the new record to the tblLocation and then performs the after update event of the combobox?

Sorry for all the questions!
Jan 6 '15 #3
Seth Schrock
2,965 Expert 2GB
1. You would put all the controls necessary to be able to add a new location.

3. Change the code to
Expand|Select|Wrap|Line Numbers
  1. If Me.Combobox_Name = 0 Then
  2.    DoCmd.OpenForm FormName:="NewForm", WindowMode:=acDialog
  3.    Me.Combobox_name.Requery
  4.  
  5.    'Set the combobox to the new location
  6.    'glNewLocation is the global variable that you need to create
  7.    Me.Combobox_name = glNewLocation
  8. End If
4. Once the form opens, you add the new location and then click the close button.

5. Code added in step 3

6. Code added in step 3

New Step 8. In your new form's OnLoad event, add the following:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Leave this code as is. Don't change any names in it.

This should do it.
Jan 6 '15 #4
So I've made the new form, set it to modal, put the code in 8 above into the OnLoad event and in the OnClose event made the global variable equal the textbox.

I also put the global variable in a new module as a string, is this correct?

In the data entry form, I have put the code in 3 into the AfterUpdate event (and changed the combobox_name to its actual name!).

I'm getting an error though when I try out the new form:

"The expression After Update you entered as the event property setting produced the following error: A problem occured while Microsoft Access was communicating with the OLE server or ActiveX control."

Any idea what's going on here?
Jan 7 '15 #5
Seth Schrock
2,965 Expert 2GB
Please post exactly what you have in the AfterUpdate event, including the Private Sub/End Sub parts (using Code tags).

Also, what is the error number that you are getting?
Jan 7 '15 #6
I've redone the whole form and using your method, with a slight change, I've managed to make it work!

On the data entry form, the new Combobox is called cmdLocationID. The "NewForm" is now "frmLocation" and glNewLocationID is the global variable which stores the ID number of the new location. I've made the first ID of the locations be stored as <Other>, so when the user selects <Other> it opens frmLocation. In the AfterUpdate event of frmLocation, the ID number is stored in glNewLocationID which is then used to change the value of the combo box on the data entry form

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdLocationID_AfterUpdate()
  2. If Me.cmdLocationID.Column(0) = 1 Then
  3.     DoCmd.OpenForm "frmLocation", , , , , acDialog
  4.     Me.cmdLocationID.Requery
  5.     Me.cmdLocationID.Value = glNewLocationID
  6. End If
  7. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub FileLocation_AfterUpdate()
  2. glNewLocationID = Me.LocationID
  3. End Sub
Many thanks for all your help!
Jan 7 '15 #7
Seth Schrock
2,965 Expert 2GB
Like I said, it may not be the easiest to design, but I really like this method for the user. It is really easy to explain how to do it to the end user.

Good luck on your project.
Jan 7 '15 #8
It's a little awkward but does the job unlike how the program wants it to happen so it's all good with me! Thanks for all the help, no doubt I'll be back again with more questions :)
Jan 7 '15 #9

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

Similar topics

2
by: MLH | last post by:
Combo box LimitToList property setting of No does not prevent the MS Access error "The text you enter must match an entry in the list" from popping up. What makes this bad is that the error is not...
3
by: Douglas Bell | last post by:
i get this error sometimes when accessing the database throug my web brouser Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Inetpub\wwwroot\fpdb\asplogin.mdb; what can i do to fix it it...
3
by: Giloosh | last post by:
Hello, i have a microsoft access application and right now, anyone knowing how to use microsoft-access can easily go behind the applicatio, design the forms, delete edit/tables etc... There is...
7
by: MLH | last post by:
Building Applications with Microsoft Access 97 is a publication I think I need. Is it available in book form? Is MicroSoft the sole vendor? Anybody got a copy they wanna sell???
17
by: Pam Ammond | last post by:
I need to use Microsoft Access Automation within a Visual Studio 2003 program written in C# for Windows Forms. When a button is clicked in my VS.NET program, I want it to run a Microsoft Access...
4
by: bbdobuddy | last post by:
Hi, How do I open a Microsoft Access 2003 form from Visual Basic.net Thanks in advance bbdobuddy
1
by: somersbar | last post by:
hey, ive been trying to set up a web form in visual basic.net that can access a microsoft access database. i need to use odbc also. i can get it working using a windows form but not a web form....
2
by: mdimitris | last post by:
Goodevening I am new to the community and I would like to post a question. I think the solution is simple I just couldnt find the right one. I want to build a simpe program that will manage an...
24
by: joeldault | last post by:
Question For Microsoft Access Data Base -------------------------------------------------------------------------------- I am Trying to create a single formula that would do the following: If...
3
by: navda | last post by:
hi ... i want the solution for this question please help me out. i have created a database in microsoft access database 2003 .the name of my database is information and i have...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.