Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

911 ...Strangest thing happening

Status
Not open for further replies.

BizLink

Technical User
Jan 28, 2003
8
US
I created a data base...I created the forms using the wizard....it worked perfectly....made 2 backups of it to be safe! I added a command button to one form to input data in another form......no problem....works like a charm. test it, tested it again, tested about 20-30 times. No problem! then all of the sudden I'm getting an error message when I try to use the command button.....mind you I didn't change, add, delete except maybe one thing I changed the sort order. But the wierd part is I made to back ups (prior to the problem and tested them both) and now both of the back ups are creating the same error. Here is the error I'm getting.....

The expression OnClick you entered as the event property setting produced the following error: Error accessing file. Network connection may have been lost.

*The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event or macro.

I should mention that I created the command button using the wizard as well.....so I didn't mess with anything. I should also metion that I'm not on a network....just a single computer.

HELP!!!!!!!!!!!!
 
Can you show us the command button code, or any other code that you are running. Anthony J. DeSalvo
President - ScottTech Software
"Integrating Technology with Business"
 
BizLink:

Check out this FAQ faq705-2529 (in Access Modules forum).

I had the same error message appear in a 2K app I developed after I imported some modules from a 97 app.

You indicated that you had only changed a sort order so I'm not sure if this will help but it sounds familiar. Larry De Laruelle
ldelaruelle@familychildrenscenter.org

 
I don't really know how to see the code...but I would be glad to email you the whole database? It's only about 700k and it's not a matter of national security.

FYI....I just now created a new version and it is working fine....I even saved it in a completely seperate folder...sounds stupid but, hell, who knows....I need to have this job done, like yesterday.
 
I have simply scrapped everything and started over.....everything is working fine now..
(fingers crossed). I also re-installed access.


I'm trying to do something else now.......

I have one form/table for insurance companies (called: Insurance Company Info) it has ins. co. adress, phone, and a few other pieces of data unrelated.

I have the insurance company as a combo box set up to retrieve from another form/table called (insurance company list)...I would like to have all of the data from the Insurance company list form go into the appropriate boxes on the Insurance Co. info form.

Like the address, phone, zip, etc.

Is this possible?
 
I just learned how to do this a couple weeks ago.

I have a cbo486Contact where I choose the Contact Name. In the cbo486Contact Row Source, I grabbed all the fields I wanted to populate. In the Column Widths property, I changed any to zero that I didn't want to see while picking from the drop-down list. Then for the On Change Event Procedure, I used the code below. The column # indicates which column the data is in from the Row Source. The first column is zero, so count from that. Since many of my records are missing pieces of the contact information, I also had to check for 0 length fields and display null. This way, if the user chooses the wrong Contact, when they pick a new one, it will overwrite all the fields with the new data.

Private Sub cbo486Contact_Change()

If Len(Me.cbo486Contact.Column(2)) <> 0 Then
Me.txt486ContactPhone = Me.cbo486Contact.Column(2)
Else
Me.txt486ContactPhone = Null
End If
If Len(Me.cbo486Contact.Column(3)) <> 0 Then
Me.txt486ContactEmail = Me.cbo486Contact.Column(3)
Else
Me.txt486ContactEmail = Null
End If
If Len(Me.cbo486Contact.Column(4)) <> 0 Then
Me.txt486ContactExtension = Me.cbo486Contact.Column(4)
Else
Me.txt486ContactExtension = Null
End If
If Len(Me.cbo486Contact.Column(5)) <> 0 Then
Me.txt486ContactAddress1 = Me.cbo486Contact.Column(5)
Else
Me.txt486ContactAddress1 = Null
End If
If Len(Me.cbo486Contact.Column(6)) <> 0 Then
Me.txt486ContactAddress2 = Me.cbo486Contact.Column(6)
Else
Me.txt486ContactAddress2 = Null
End If
If Len(Me.cbo486Contact.Column(7)) <> 0 Then
Me.txt486ContactCity = Me.cbo486Contact.Column(7)
Else
Me.txt486ContactCity = Null
End If
If Len(Me.cbo486Contact.Column(8)) <> 0 Then
Me.cbo486State = Me.cbo486Contact.Column(8)
Else
Me.cbo486State = Null
End If
If Len(Me.cbo486Contact.Column(9)) <> 0 Then
Me.txt486ContactZip = Me.cbo486Contact.Column(9)
Else
Me.txt486ContactZip = Null
End If
If Len(Me.cbo486Contact.Column(10)) <> 0 Then
Me.txt486ContactFax = Me.cbo486Contact.Column(10)
Else
Me.txt486ContactFax = Null
End If
If Len(Me.cbo486Contact.Column(11)) <> 0 Then
Me.cbo486ContactMode = Me.cbo486Contact.Column(11)
Else
Me.cbo486ContactMode = Null
End If

End Sub


kdk13
 
Thank you.....I noticed the code is referring to columns. I am using justified forms would it still all refer to columns? No rows?

I'm not a programmer so I have to ask stupid questions.

My guess is that some of the code will be different for me, being that my fields and form have a different name.

I'm 100% sure swhich parts will differ.....
 
The columns are the columns from the drop-down list. The drop-down acts like a temp table or an array while you are picking an item.

Your Row Source should show all fields you want to eventually populate onto the form and these get stored into columns in the drop down list. For example, in your Row Source, you pick InsCoID, InsCoName, InsCoPhone, InsCoAddr. Within the drop down, all the info is there: InsCoID is column 0, InsCoName is 1, InsCoPhone is 2, InsCoAddr is 3. (For any you columns don't want to actually see in the drop-down, change that columns Column Widths property to 0.)

Now say your drop-down populates the InsCoName in the combobox field.

So your On Change event to populate the Phone and Address would look like:

Private Sub cboInsCo_Change()

If Len(Me.cboInsCo.Column(2)) <> 0 Then
Me.InsCoPhoneObjectName = Me.cboInsCo.Column(2)
Else
Me.InsCoPhoneObjectName = Null
End If
If Len(Me.cboInsCo.Column(3)) <> 0 Then
Me.InsCoAddrObjectName = Me.cboInsCo.Column(3)
Else
Me.InsCoAddrObjectName = Null
End If

End Sub

The Me.InsCo...ObjectName would be the Name of the object where you want to display the data.

Hope this helps!

kdk13
 
Thanks again....I'm going to give this a try...hopefully I can make this work....I'll let ya know.

Tony
 
BizLink:

I've run into your problem before, quite recently, actually, but for a slightly different form related issue.

You need to be EXTREMELY careful if you decide to copy and paste form buttons or other elements that have VB event code attached to it - this is an Access 2000 issue, mainly, but I wouldn't be surprised if it cropped up in XP.

There is a fix for this - Office 2000 SP1, but even after applying the patch, it can still crop up, almost like a virus.

Watch out, adding the SP1 patch can be quite confusing - you need to read the instructions carefully to get all of the patches and apply them in the right order.

The SR1A and SP1 patches are available from the link below.

The best solution - go to MS, get the patches, and then create your new database after they are applied.

I've tried importing DB objects that have been corrupted via this problem into a new DB file but the same problem still crops up, despite the patch - which basically means you need to start clean with the patches in place first - you can't repair or fix an existing problem easily.

Here is the relevant link from the Microsoft Knowledge Base:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top