iahclarke
07-09-2008, 10:02 AM
I have a problem and its giving me a serious headache! Maybe you guys could help me?
I've got a blank form which you can fill out progressively. Firstly, when you add a new record, a popup appears asking you to fill in a company name and subsidiary. When you've done that, you should click "continue" and the database should pull in all the associated fields to do with the selected company into the form for you.
Unfortunately, once you have selected the company (picture 1), it deletes the new record and gives an error message (picture 2: "Runtime error 2101: The setting you entered isn't valid for this property").
Picture 3 shows the error message and underlying coding.
Picture 4 shows modCommon which is referred to in the error line.
Any help you could give would be much appreciated as I am completely stumped!
DJkarl
07-09-2008, 10:13 AM
If the name of the Module is "OpenWordDoc" and the name of the Sub is also "OpenWordDoc" that can cause issues. Try renaming one of them.
iahclarke
07-09-2008, 11:14 AM
Thanks very much DJkarl! Much appreciated.
However this new error still won't go away. Maybe some similarly brilliant words of wisdom anyone?
DJkarl
07-09-2008, 11:37 AM
Is there a specific reason you are using .Text instead of .Value, if you use .Value you do not need to have focus to assign the value.
Also if NewCompanyName is a public property (which it appears as though it is) you do not need to reference the module name, you can just reference the property name.
IE
Me.CompanyNameID.Value = NewCompanyName
or even easier
Me.CompanyNameID = NewCompanyName
as you don't actually need to put the .Value on for text box controls.
iahclarke
07-10-2008, 08:06 AM
Haha you know what I didn't even think about that. Ok good idea - sorted.
Now I'm getting compile error 'user defined type not defined' on the line:
Dim Applic As Word.Application
...
DJkarl
07-10-2008, 08:16 AM
Haha you know what I didn't even think about that. Ok good idea - sorted.
Now I'm getting compile error 'user defined type not defined' on the line:
Dim Applic As Word.Application
...
Check your references, is Microsoft Word listed or does it say MISSING or broken?
iahclarke
07-10-2008, 10:48 AM
Spot on - MS Word Utilities wasn't checked. It is now and its all working. That's actually fixed pretty much the whole thing!
DJKarl you have been great! I really appreciate all the help and spoon feeding!
Last question, since you've been so helpful already!
I'm trying to convert a DAO function from old Access 97 coding to work in this new version.
The old coding is:
Set rsSource = dbSource.OpenRecordset(Name:="CompaniesSql", Type:=dbOpenDynaset)
..This doesn't work in Access 2003. I could use the more up-to-date ADO function but that would mean rewriting a lot more of the code and that's just too complicated.
My new coding is:
Set rsSource = dbSource.OpenRecordset(Name:="CompaniesSql", Type:=dbOpenDynaset, Options:=dbReadOnly, LockEdit:=dbOptimistic)
..But it's not working (surprise, surprise) - it's coming out with the Runtime error 3001: Invalid arguement.
DJkarl
07-10-2008, 10:55 AM
Spot on - MS Word Utilities wasn't checked. It is now and its all working. That's actually fixed pretty much the whole thing!
DJKarl you have been great! I really appreciate all the help and spoon feeding!
Last question, since you've been so helpful already!
I'm trying to convert a DAO function from old Access 97 coding to work in this new version.
The old coding is:
Set rsSource = dbSource.OpenRecordset(Name:="CompaniesSql", Type:=dbOpenDynaset)
..This doesn't work in Access 2003. I could use the more up-to-date ADO function but that would mean rewriting a lot more of the code and that's just too complicated.
My new coding is:
Set rsSource = dbSource.OpenRecordset(Name:="CompaniesSql", Type:=dbOpenDynaset, Options:=dbReadOnly, LockEdit:=dbOptimistic)
..But it's not working (surprise, surprise) - it's coming out with the Runtime error 3001: Invalid arguement.
Don't be in a hurry to move to ADO, DAO is much better when dealing with Access objects.
make sure your recordset object is declared as a DAO type recordset
dim rsSource as DAO.Recordset
Set rsSource = dbSource.OpenRecordset("CompaniesSql", dbOpenDynaset)