Full Version: You can't assign a value to this object?
UtterAccess Forums > Microsoft® Access > Access Forms
scottye
I have a form with a sub form (with tabs). However, I have a few issues. One, I'm not the one that designed it.

What my problem is. In the middle of the form there is a tabbed sub form. On the tab form is a very important part of the database. The sub form hold information such as their skills, etc. This is used when the staff conducts a candidate search (on another form) it pulls up all candidates that match to call for a job.
But when I changed things I used to get a pop up that said, Save, Change, or Paste (something like that). So, to work around it, I kept the cmdbutton on there. the Add Skills cmd button is where the staff clicks the information the candidate put on their application. Now all of a sudden we can't. Every time someone clicks on it a run time error that says...
Run-time error '-21473552567 (800020009)':
you can assign a value to this object

Like I said. It worked fine for some time now. Then early today it started and I can’t figure out why?

PS - I attached a copy of the form

Edited by: scottye on Wed Jun 14 16:07:37 EDT 2006.
RuralGuy
Can you post the code behind the button?
scottye
Private Sub Form_Current()
[CandidateId] = [Forms]![frmCandidateEdit].[CanidateID]
And Sub
RuralGuy
That is the code for the Current Event. What code is behind the "Add Skills" button?
scottye
My fault...brain fart.
Private Sub Command28_Click()
'check to see if tblCandidateResume entry exists for this candidate first
'if not then add one

Dim db As Database
Dim SQL As String
Dim Rst As Recordset
Dim SearchTxt As String
Set db = CurrentDb()
Dim Entries As Integer

Entries = DCount("[CandidateId]", "tblCandidateResume", "[CandidateId] = [Forms]![frmCandidateEdit].[CanidateID]")
If Entries = 0 Then
'add the entry for this candidate
Set db = CurrentDb()
Set Rst = db.OpenRecordset("tblCandidateResume", dbOpenDynaset)

Rst.AddNew
Rst!CandidateId = [Forms]![frmCandidateEdit].[CanidateID]
Rst.Update
End If

db.Close
Set db = Nothing
Set Rst = Nothing

DoCmd.OpenForm "frmCandidateSkillsEdit", acNormal
End Sub
RuralGuy
I would start by disambiguating your variables.
Dim db As DAO.Database
Dim Rst As DAO.Recordset


Why do you Set db = CurrentDb() twice.

Is this code executing on the frmCandidateEdit form?

The debugger should have highlighted a single line it didn't like. It would be useful to know which line it didn't like.


Edited by: RuralGuy on Wed Jun 14 19:43:32 EDT 2006.
scottye
----I don't know what this means...
I would start by disambiguating your variables.
Dim db As DAO.Database
Dim Rst As DAO.Recordset

Why do you Set db = CurrentDb() twice. ---- I have no idea. This is the way it always was. I never checked into it until now.

Is this code executing on the frmCandidateEdit form? ----Yes...

The debugger should have highlighted a single line it didn't like. It would be useful to know which line it didn't like.
When the error comes up, and I hit debugger it highlights...
Private Sub Form_Current()
this one -->[CandidateId] = [Forms]![frmCandidateEdit].[CanidateID]

End Sub
Edited by: scottye on Wed Jun 14 19:51:16 EDT 2006.
RuralGuy
Is the CandidateID control on the frmCandidateEdit form bound to the [CandidateID] of the underlying query/table? In other words, is that the ControlSource of the control? Is this the CurrentEvent of the frmCandidateEdit form? We're getting closer to the actual problem.
scottye
Yes...the CandidateID is the control source of the frmCandidateEdit.
I was going over (and over and over, etc) this here and I tried something. I removed the sub form (the one in the middle with the tabs) that shows the skills, etc... The one that works off the skills we check off using the Add Skills cmd button. Well, when removed the sub form, clicked on ADD SKILLS cmdbutton... the form that came up worked with out error. Put the subform back on and the error came back. I am so confused now.
Maybe this will help you, because I am probably explaining this wrong or confusing you. I attached a very scaled down version of the db.
RuralGuy
The db helps a lot. The error is in the CurrentEvent of the next form to open [frmCandidateSkillsEdit]. Just comment out the event. It is not needed anyway.
scottye
OMG...that's all it was. Something as small as that.
Thank you very much RG.
Otried it on my laptop first and i worked nicely. Then I went on the server and work and I removed the CurrentEvent from [frmCandidateSkillsEdit] and it didn't work. No error but it won't let me check anything off. Is this maybe due to the db being split (FE and BE)? Oh, it's not split on the laptop.
scottye
Uh, this is strange. It's working. But what I have to do is...make sure to click on one of the other tabs, then click on the Add Skills and it'll allow me to check of the skills. I am really going to have to sit down and tear this thing apart.
RuralGuy
Have fun. It should be an interesting challenge. Post back if you need any additional assistance.
scottye
I figured it out. The Candidate tab and the Add Skills form can't be open at the same time. Man, I love updating another persons database. the one I showed you is completely overhauled from the old one. You should have seen that nightmare.
Thanks again RG. You are a life saver!
RuralGuy
You are certainly welcome. Just glad I could help. Enjoy the rest of the project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.