Assigning a Value

A

Amour

Hi please help I am new to Access.

I put this section into the load event on a form:

Private Sub Form_Load()
ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")
End Sub

ACT_TRVL is connected to TblAttendance and is a Text field

The problem I am having is that I get an error message (but it still works
ok):

"Object doesn't support this property or method"

The problem with this program is that it was developed to have the user
input (manualy) the calculated resault from excell. So now I come along and
attach a form (query) that is for calculating/displaying dates on that same
form/field (ACT_TRVL), remember now that there is other reports attached to
that field(ACT_TRVL). So it looks like there is no other way. That is why I
need to store that field (I know it is not a good programming way but for
know). So I still need to fix this problem it has to go to ACT_TRVL.

I checked to see if assigning a value was the problem so I put:

Me.ACT_TRVL = 0

and yes that did send the same message.

So what could it be?

Please Help And again Thank You
 
K

Klatuu

Your diescription of the problem is not absolutely clear.
Is ACT_TRVL a Text Box control on your form or is it a field in a table?
You mention fields, but often people get confused (mainly because a lot of
Access documention misleads them) between fields and controls. Forms do not
have fields - they have controls. Fields belong to tables. If you always
relate to them this way, there will be no confusion.

Another issue (and MS is guilty of this as well) is naming objects. When
you use the wizard to create a form, it gives the control the same name as
the field it is bound to. This is not only confusing for we human types, but
can also confuse Access.

In any case, you should always qualify your objects. You can use the key
word Me when referencing any object on the current form. Try:

Me.ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")

Post back if that doesn't resolve it, and identify your field and control
names.
 
A

Amour

I found the problem thank You for helping.

Klatuu said:
Your diescription of the problem is not absolutely clear.
Is ACT_TRVL a Text Box control on your form or is it a field in a table?
You mention fields, but often people get confused (mainly because a lot of
Access documention misleads them) between fields and controls. Forms do not
have fields - they have controls. Fields belong to tables. If you always
relate to them this way, there will be no confusion.

Another issue (and MS is guilty of this as well) is naming objects. When
you use the wizard to create a form, it gives the control the same name as
the field it is bound to. This is not only confusing for we human types, but
can also confuse Access.

In any case, you should always qualify your objects. You can use the key
word Me when referencing any object on the current form. Try:

Me.ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")

Post back if that doesn't resolve it, and identify your field and control
names.
--
Dave Hargis, Microsoft Access MVP


Amour said:
Hi please help I am new to Access.

I put this section into the load event on a form:

Private Sub Form_Load()
ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")
End Sub

ACT_TRVL is connected to TblAttendance and is a Text field

The problem I am having is that I get an error message (but it still works
ok):

"Object doesn't support this property or method"

The problem with this program is that it was developed to have the user
input (manualy) the calculated resault from excell. So now I come along and
attach a form (query) that is for calculating/displaying dates on that same
form/field (ACT_TRVL), remember now that there is other reports attached to
that field(ACT_TRVL). So it looks like there is no other way. That is why I
need to store that field (I know it is not a good programming way but for
know). So I still need to fix this problem it has to go to ACT_TRVL.

I checked to see if assigning a value was the problem so I put:

Me.ACT_TRVL = 0

and yes that did send the same message.

So what could it be?

Please Help And again Thank You
 
K

Klatuu

Great, glad the problem is resolved.
Now, to help others who may have the same problem, it would be good to post
the resolution to the problem and mark the post as Answered. That way,
others looking for help with the same problem can find the answer.
--
Dave Hargis, Microsoft Access MVP


Amour said:
I found the problem thank You for helping.

Klatuu said:
Your diescription of the problem is not absolutely clear.
Is ACT_TRVL a Text Box control on your form or is it a field in a table?
You mention fields, but often people get confused (mainly because a lot of
Access documention misleads them) between fields and controls. Forms do not
have fields - they have controls. Fields belong to tables. If you always
relate to them this way, there will be no confusion.

Another issue (and MS is guilty of this as well) is naming objects. When
you use the wizard to create a form, it gives the control the same name as
the field it is bound to. This is not only confusing for we human types, but
can also confuse Access.

In any case, you should always qualify your objects. You can use the key
word Me when referencing any object on the current form. Try:

Me.ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")

Post back if that doesn't resolve it, and identify your field and control
names.
--
Dave Hargis, Microsoft Access MVP


Amour said:
Hi please help I am new to Access.

I put this section into the load event on a form:

Private Sub Form_Load()
ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")
End Sub

ACT_TRVL is connected to TblAttendance and is a Text field

The problem I am having is that I get an error message (but it still works
ok):

"Object doesn't support this property or method"

The problem with this program is that it was developed to have the user
input (manualy) the calculated resault from excell. So now I come along and
attach a form (query) that is for calculating/displaying dates on that same
form/field (ACT_TRVL), remember now that there is other reports attached to
that field(ACT_TRVL). So it looks like there is no other way. That is why I
need to store that field (I know it is not a good programming way but for
know). So I still need to fix this problem it has to go to ACT_TRVL.

I checked to see if assigning a value was the problem so I put:

Me.ACT_TRVL = 0

and yes that did send the same message.

So what could it be?

Please Help And again Thank You
 
A

Amour

Basiclly I copied things from other forms that were causing the problems:

Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo ERRor_frm_BeforeUpdate
'oldestval = IIf(IsNull(Me!EST_TRVL.OldValue), 0, Me!EST_TRVL.OldValue)
'NewEstVal = Me!EST_TRVL
'OldActVal = IIf(IsNull(Me!ACT_TRVL.OldValue), 0, Me!ACT_TRVL.OldValue)
'NewActVal = Me!ACT_TRVL
'OldSalVal = IIf(IsNull(Me!AMT_PAID.OldValue), 0, Me!AMT_PAID.OldValue)
'NewSalVal = Me!AMT_PAID
'estchangeval = 0
'actchangeval = 0
'SalChangeVal = 0

'If oldestval <> NewEstVal Then
'estchangeval = NewEstVal - oldestval
'Else

'End If
'If OldActVal <> NewActVal Then
'actchangeval = NewActVal - OldActVal
'End If
'If OldSalVal <> NewSalVal Then
'SalChangeVal = NewSalVal - OldSalVal
'End If



Error_frm_BeforeUpdate_end:
Exit Sub

ERRor_frm_BeforeUpdate:
MsgBox Error$
Resume Error_frm_BeforeUpdate_end



End Sub


When I put a ' in front of everything I just turn it into display. I know
that I have not deleted all but I just want to make sure (test, test, test)
before I do.

Thank You alot

Klatuu said:
Great, glad the problem is resolved.
Now, to help others who may have the same problem, it would be good to post
the resolution to the problem and mark the post as Answered. That way,
others looking for help with the same problem can find the answer.
--
Dave Hargis, Microsoft Access MVP


Amour said:
I found the problem thank You for helping.

Klatuu said:
Your diescription of the problem is not absolutely clear.
Is ACT_TRVL a Text Box control on your form or is it a field in a table?
You mention fields, but often people get confused (mainly because a lot of
Access documention misleads them) between fields and controls. Forms do not
have fields - they have controls. Fields belong to tables. If you always
relate to them this way, there will be no confusion.

Another issue (and MS is guilty of this as well) is naming objects. When
you use the wizard to create a form, it gives the control the same name as
the field it is bound to. This is not only confusing for we human types, but
can also confuse Access.

In any case, you should always qualify your objects. You can use the key
word Me when referencing any object on the current form. Try:

Me.ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")

Post back if that doesn't resolve it, and identify your field and control
names.
--
Dave Hargis, Microsoft Access MVP


:

Hi please help I am new to Access.

I put this section into the load event on a form:

Private Sub Form_Load()
ACT_TRVL = DLookup("[GTotal]", "qryTravel", "[SSN] = '" & [SSN] & "'")
End Sub

ACT_TRVL is connected to TblAttendance and is a Text field

The problem I am having is that I get an error message (but it still works
ok):

"Object doesn't support this property or method"

The problem with this program is that it was developed to have the user
input (manualy) the calculated resault from excell. So now I come along and
attach a form (query) that is for calculating/displaying dates on that same
form/field (ACT_TRVL), remember now that there is other reports attached to
that field(ACT_TRVL). So it looks like there is no other way. That is why I
need to store that field (I know it is not a good programming way but for
know). So I still need to fix this problem it has to go to ACT_TRVL.

I checked to see if assigning a value was the problem so I put:

Me.ACT_TRVL = 0

and yes that did send the same message.

So what could it be?

Please Help And again Thank You
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top