Save me from the compile errors! (1 Viewer)

iahclarke

New member
Local time
Today, 01:32
Joined
Jun 10, 2006
Messages
6
Problems Updating fields: Please help!

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!
 

Attachments

  • 1.jpg
    1.jpg
    98.8 KB · Views: 180
  • 2.JPG
    2.JPG
    80.4 KB · Views: 171
  • 3.jpg
    3.jpg
    95.6 KB · Views: 167
  • 4.jpg
    4.jpg
    91.4 KB · Views: 153
Last edited:

DJkarl

Registered User.
Local time
Yesterday, 19:32
Joined
Mar 16, 2007
Messages
1,028
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

New member
Local time
Today, 01:32
Joined
Jun 10, 2006
Messages
6
Thanks very much DJkarl! Much appreciated.

However this new error still won't go away. Maybe some similarly brilliant words of wisdom anyone?
 

DJkarl

Registered User.
Local time
Yesterday, 19:32
Joined
Mar 16, 2007
Messages
1,028
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

New member
Local time
Today, 01:32
Joined
Jun 10, 2006
Messages
6
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

Registered User.
Local time
Yesterday, 19:32
Joined
Mar 16, 2007
Messages
1,028
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

New member
Local time
Today, 01:32
Joined
Jun 10, 2006
Messages
6
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

Registered User.
Local time
Yesterday, 19:32
Joined
Mar 16, 2007
Messages
1,028
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

Code:
dim rsSource as DAO.Recordset
 
Set rsSource = dbSource.OpenRecordset("CompaniesSql", dbOpenDynaset)
 

Users who are viewing this thread

Top Bottom