Method of Data Member Not found

  • Thread starter Gaetanm via AccessMonster.com
  • Start date
G

Gaetanm via AccessMonster.com

I have a form that has a combo box EmployrrID it puls down the Id and
automaticly fills two text fields, The job nomber he is working on
and the description. there is a button on the form that executes a
Now command and puts that time is a text field called StopTime.

I have another button that should update an existing record but I keep
getting this Method of data.. error.

My code is below. Is the problem with the StopTime text field?

Option Compare Database


Private Sub Command21_Click()

Dim SQLstrg As String

SQLstrg = "UPDATE Clock_Table SET [StopDate] = #" & Me.StopDate & "# WHERE ((
[StopDate] Is Null) And ([EmployeeID] = " & Me.[EmployeeID].[Column(0)] & "))
;"


End Sub

Private Sub Command4_Click()
Me.StopDate = Now
End Sub

Any help would greatly be appreciated

Gaetanm
 
V

Van T. Dinh

I can't see your database but in the description, you wrote "StopTime" but
in the code you used "StopDate"???
 
R

ruralguy via AccessMonster.com

That can't be all of the code. Your Command21_Click() does not really do
anything. What line is highlighted when the debugger pops up?
I have a form that has a combo box EmployrrID it puls down the Id and
automaticly fills two text fields, The job nomber he is working on
and the description. there is a button on the form that executes a
Now command and puts that time is a text field called StopTime.

I have another button that should update an existing record but I keep
getting this Method of data.. error.

My code is below. Is the problem with the StopTime text field?

Option Compare Database

Private Sub Command21_Click()

Dim SQLstrg As String

SQLstrg = "UPDATE Clock_Table SET [StopDate] = #" & Me.StopDate & "# WHERE ((
[StopDate] Is Null) And ([EmployeeID] = " & Me.[EmployeeID].[Column(0)] & "))
;"

End Sub

Private Sub Command4_Click()
Me.StopDate = Now
End Sub

Any help would greatly be appreciated

Gaetanm
 
D

Dirk Goldgar

Gaetanm via AccessMonster.com said:
I have a form that has a combo box EmployrrID it puls down the Id and
automaticly fills two text fields, The job nomber he is working on
and the description. there is a button on the form that executes a
Now command and puts that time is a text field called StopTime.

I have another button that should update an existing record but I keep
getting this Method of data.. error.

My code is below. Is the problem with the StopTime text field?

Option Compare Database


Private Sub Command21_Click()

Dim SQLstrg As String

SQLstrg = "UPDATE Clock_Table SET [StopDate] = #" & Me.StopDate & "#
WHERE (( [StopDate] Is Null) And ([EmployeeID] = " &
Me.[EmployeeID].[Column(0)] & ")) ;"


End Sub

Private Sub Command4_Click()
Me.StopDate = Now
End Sub

Any help would greatly be appreciated

Gaetanm

I'm guessing your problem is with this:
Me.[EmployeeID].[Column(0)]

The column index should go outside the square brackets:

Me.[EmployeeID].[Column](0)

or, more simply, like this:

Me.EmployeeID.Column(0)

If .Column(0) is the bound column of the combo box, by the way, you
don't need to refer to the Column property at all, and could just use
this:

Me.EmployeeID

But I don't know whether it's the bound column or not.
 
G

Gaetanm via AccessMonster.com

Dirk said:
I have a form that has a combo box EmployrrID it puls down the Id and
automaticly fills two text fields, The job nomber he is working on
[quoted text clipped - 25 lines]

I'm guessing your problem is with this:
Me.[EmployeeID].[Column(0)]

The column index should go outside the square brackets:

Me.[EmployeeID].[Column](0)

or, more simply, like this:

Me.EmployeeID.Column(0)

If .Column(0) is the bound column of the combo box, by the way, you
don't need to refer to the Column property at all, and could just use
this:

Me.EmployeeID

But I don't know whether it's the bound column or not.
I have a form called Clock_Stop_Table
The purpose of this form is to UPDATE a existing record in the
Clock_Table

It consist of 4 fields and 2 buttons

ComboBox with the query [Jobs not Completed] that’s made up of 3 linked
tables.

EmployeeId, FirstName, LastName, JobID, Notes, StartDate, StopDate
Number Number Txt Date/Time
Date/Time


Is Not NULL Is Null

2 text boxes
JobID Lable =EmployeeId.Column(4) {deleted Lable} =EmployeeId.Column(5)

StopDate This Field is populated by a button [Input Stop Time}

Date/Time

The Input Stop Time button populates the text box StopTime

Private Sub Command4_Click()
Me.StopDate = Now
End Sub

Now is where I think I’m getting into trouble !

This button should UPDATE the table called Clock_Table the table has the
following:

JobID EmployeeId StopDate StartDate
Number Number Date/Time DateTime

Here is the Code for the button with the Me.EmployeeId fixed:

Private Sub Command21_Click()

Dim SQLstrg As String

SQLstrg = "UPDATE Clock_Table SET [StopDate] = #" & Me.StopDate & "# WHERE ((
[StopDate] Is Null) And ([EmployeeID] = " & Me.EmployeeID & "))
;"

End Sub

The area that is grayed out by debug is StopDate as in & Me.StopDate

I have onother form my Strat time imput form and is setup about the same as
far as the txt field being populated by a start time button and SAVES the
record just fine its this update with this form thats driving me nuts

I hope the above helps in identifying the problem i'm a novice at this
any help and suggestion is greatly appreciated

Gaetanm
 
D

Dirk Goldgar

Gaetanm via AccessMonster.com said:
I have a form called Clock_Stop_Table
The purpose of this form is to UPDATE a existing record in the
Clock_Table

It consist of 4 fields and 2 buttons

ComboBox with the query [Jobs not Completed] that's made up of 3
linked tables.

EmployeeId, FirstName, LastName, JobID, Notes, StartDate, StopDate
Number Number Txt
Date/Time Date/Time


Is Not NULL Is Null

2 text boxes
JobID Lable =EmployeeId.Column(4) {deleted Lable}
=EmployeeId.Column(5)

StopDate This Field is populated by a button [Input Stop Time}

Date/Time

The Input Stop Time button populates the text box StopTime

Private Sub Command4_Click()
Me.StopDate = Now
End Sub

Now is where I think I'm getting into trouble !

This button should UPDATE the table called Clock_Table the table has
the following:

JobID EmployeeId StopDate StartDate
Number Number Date/Time DateTime

Here is the Code for the button with the Me.EmployeeId fixed:

Private Sub Command21_Click()

Dim SQLstrg As String

SQLstrg = "UPDATE Clock_Table SET [StopDate] = #" & Me.StopDate & "#
WHERE (( [StopDate] Is Null) And ([EmployeeID] = " & Me.EmployeeID &
")) ;"

End Sub

The area that is grayed out by debug is StopDate as in & Me.StopDate

I have onother form my Strat time imput form and is setup about the
same as far as the txt field being populated by a start time button
and SAVES the record just fine its this update with this form thats
driving me nuts

I hope the above helps in identifying the problem i'm a novice at this
any help and suggestion is greatly appreciated

I can't tell from your description exactly what error you're getting
now. Assuming you're getting an error message of some sort, please post
both the error number (if available) and error message.

For what it's worth, the button code you posted:
Private Sub Command21_Click()

Dim SQLstrg As String

SQLstrg = "UPDATE Clock_Table SET [StopDate] = #" & Me.StopDate & "#
WHERE (( [StopDate] Is Null) And ([EmployeeID] = " & Me.EmployeeID &
")) ;"

End Sub

.... will build the SQL statement, but not actually execute it. You'd
need to add a line to execute the SQL statement; either "DoCmd.RunSQL
SQLstrg" or "CurrentDb.Execute SQLstrg, dbFailOnError". But if you're
getting an error in building the SQL string, there's no point in making
that fix yet.
 

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

Top