Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method or data member not found (Error 461)

Status
Not open for further replies.

uscitizen

Technical User
Jan 17, 2003
672
US
hi, i have created a field in a source table for a form. the field's name is Form_Flag, it's in a table for the 'Registration' form which happens to be called 'Registration' as well. with that out of the way, i wrote some code in the OnCurrent event property

Private Sub Form_Current()
If Me.Form_Flag = True Then
Me.AllowEdits = False
Me.EnableEditsBtn.Visible = True
Else
Me.AllowEdits = True
Me.EnableEditsBtn.Visible = False
End If
End Sub

which the compiler's balking about when it gets to 'Form_Flag'; it tells me "Method of Data member not found". true i don't have Form_Flag on the 'Registration' form, but i was led to believe by a trusted source that that wasn't necessary.

can anybody tell me what's going on?




“The philosophy of the school room in one generation will be the philosophy of government in the next." --- Abraham Lincoln
 
How are ya uscitizen . . . . .

Two things . . .

First, the Dot (.) operator signifies a property or method. The Bang (!) operator siginifies a control. Your refeencing here needs to be corrected as follows:

Private Sub Form_Current()
If Me!Form_Flag = True Then
Me!AllowEdits = False
Me!EnableEditsBtn.Visible = True
Else
Me!AllowEdits = True
Me!EnableEditsBtn.Visible = False
End If
End Sub

This alone may correct the problem.

Second, although Form_Flag does'nt have to be included on the form, it has to be included in the Record Source. Is this so?


TheAceMan [wiggle]

 
uscitizen, I understand what you are saying but you need to put Form_Flag on your form.

Me._ usally refer to a member of the active object (eg Forms or Reports).

So even trough the field Form_Flag is in the table it must be on the form (even if it's invisible) for you to reference it using Me.

Other than that you have to do an SQL call to your table and find the record you are looking for to get the value of Form_Flag.


 
well, let's see, 1 step at a time:

first of all aceman, here's my code -- as it stands now the compiler has stopped its bellyacheing (speeling)

Private Sub Form_Current()
If Me!Form_Flag = True Then
Me.AllowEdits = False
Me.EnableEditsBtn.Visible = False
Else
Me.AllowEdits = True
Me.EnableEditsBtn.Visible = False
End If
End Sub

as you see, it seems to consist in a combination of dots and bangs but the compiler's 'happy'...

and as to whether Form_Flag is on the RecordSource -- hopefully you mean to learn if Form_Flag is in the table (called 'Registration') i'm using as a RecordSource, which i can answer in the affirmative.

perhaps i should narrate the bigger picture since i'm sure this thing's not working yet....

whenever the user wants to print the underlying report for a patient entered using this 'Registration' what i would like is for the user to be reminded that that record was printed. to do this, the path i chose was to cause the form to be disabled from editing, the 'Print' button to disappear and for a button titled 'Enable Edits' to appear.

at the point when the 'Enable Edits' button is clicked, i would like the 'Print' button to re-appear, the form to become editable once again and for the 'Enable Edits' button to reappear.

i would also like the user to be able to query the database for those records which have been printed (or the reverse of this, which require editing and haven't been printed) which would be useful when the numbers of records becomes unwieldy.

so, in addition to the code above, i've written the following for the OnClick of the 'Print' report button:

Private Sub Command238_Click()
On Error GoTo Err_Command238_Click

Dim stDocName As String

Me!Form_Flag = True
Me.Refresh
Me.AllowEdits = False
DoCmd.GoToControl Me.EnableEditsBtn
Me.EnableEditsBtn.Visible = True
Me.Command238.Visible = False

stDocName = "Registration"

Me.Refresh

OpenReport_FX stDocName, acNormal, "", "[Patient Number] = " & Me![Patient Number]

Exit_Command238_Click:
Exit Sub

Err_Command238_Click:
MsgBox Err.description
Resume Exit_Command238_Click

End Sub

and the following for the OnClick event of the 'Enable Edits' button:

Private Sub EnableEditsBtn_Click()
Me.AllowEdits = True
Me.Command238.Visible = True
DoCmd.GoToControl Me.EnableEditsBtn
Me.EnableEditsBtn.Visible = False
End Sub

there's more work that needs doing though....for example, when i click on the 'Print' button, i get a message to the effect "An expression you entered is the wrong data type for one of the arguments". the 'Print' button does not disappear and the 'Enable Edits' button does not wondrously appear either.


“The philosophy of the school room in one generation will be the philosophy of government in the next." --- Abraham Lincoln
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top