Hi Hoppy,
> At work the database resides on our server and at home it's just on my PC.
You should split the database into two files: a "front-end" (FE) application
file, and a "back-end" (BE) data file. Only the BE database should be shared
on a file server; a copy of the FE application file should be installed on
each user's local hard drive. For more information, see the section of this
paper that talks about splitting:
Implementing a Successful Multiuser Access/JET Application
http://www.accessmvp.com/TWickerath/.../multiuser.htm
> There isn't an error message but the program opens up the VBA procedure and
> it's highlighted with YELLOW. There's no clues as to why it stopped there.
What happens if you press the F5 key when the code suspends? Does it finish
to completion as expected? If so, you have a "ghost" break point. Close
Access. Make a backup copy of your database (you already have this, right?)
using Windows Explorer. Then click on Start | Run and enter the following
command:
msaccess /decompile
Navigate to your application, and hold the Shift key down the *entire* time
that it is opening. You should open to the database window (or Navigation
Pane in Access 2007). While continuing to hold the Shift key down, do a
compact and repair operation:
Tools | Database Utilities | Compact and repair database
(or Office button, Manage, Compact and repair in A2007)
Finally, open any existing code module and re-compile your VBA code, by
clicking on Debug | Compile {ProjectName}
where {ProjectName} is the name of your VBA project.
Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
"Hoppy" wrote:
> Hello, I'm just learning Access programming and I wrote a database for our
> office. It works fine except for one combo box on one of the forms. The
> combo box DOES work on my home PC which is where I worked on this one form.
> But it DOESN'T work when I install the form in the database at my office! At
> work the database resides on our server and at home it's just on my PC. I've
> been working on this for two weeks and can't figure out the problem. Would
> appreciate any help.
>
> There isn't an error message but the program opens up the VBA procedure and
> it's highlighted with YELLOW. There's no clues as to why it stopped there.
>
> I have the combo box Limit to List set to YES
> I have the RecordSource Type set to Table/Query
> The RowSource is set to COMPANYTABLE Query (it sorts Company Names
> Alphabetically)
> The database has TWO tables one table just for CompanyNames with one field
> "Company Name"
> The other table has the same field "Company Name" but also contains numerous
> other fields not involved in this procedure.
> The name of the combo box is "Company"
>
> When a user enters a company that isn't on the list I want a message box to
> open asking if they want to add it. If they select Yes the name is added to
> the table "COMPANYTABLE" and that's it. The table gets the name sorts it
> into the list of names.
>
> The error is in the combo box procedure for the NotInlist.
>
> Here's the code I copied from the procedure, the error occurs at the
> db.Execute "INSERT INTO [COMPANYTABLE] ([COMPANY NAME]) VALUES (""" & NewData
> & """)", dbFailOnError
>
> Private Sub COMPANY_NotInList(NewData As String, Response As Integer)
>
> Dim db As Database
> Set db = CurrentDb
>
> Response = False
> Me.COMPANY = Null
> msg = "The company: " & Chr(13) & Chr(13) & NewData & Chr(13) & Chr(13)
> msg = msg & "is not in the list. Do you want to add it?"
> typ = vbExclamation + vbYesNo
> ttl = "New Item"
> resp = MsgBox(msg, typ, ttl)
> If resp = vbNo Then
> Me.COMPANY.Undo
> Response = acDataErrContinue
> Else
> db.Execute "INSERT INTO [COMPANYTABLE] ([COMPANY NAME]) VALUES (""" &
> NewData & """)", dbFailOnError
> Me.COMPANY.Requery
> Me.COMPANY = NewData
> Response = acDataErrAdded
> End If
>
> End Sub
>
> Any suggestions would be very much appreciated! I have the same program on
> my PC that we have at work Access 2003. However, there are permissions and
> things on the database at work. Thanks in advance for any help! Let me know
> if anyone needs more information.
>