Is the field included in the SELECT clause? A field could be included in a
WHERE clause, or an ORDER BY clause, without being included in the SELECT
clause, in which case it would not be available as a property of the form.
In the first two examples below, the field 'RecordID' will not be available,
only the third example will make this field available as a property of the
form ...
SELECT FieldOne, FieldTwo FROM SomeTable WHERE RecordID = Whatever
SELECT FieldOne, FieldTwo FROM SomeTable ORDER BY RecordID
SELECT FieldONe, FieldTwo, RecordID FROM SomeTable
Another possibility is that the field might be aliased ...
SELECT Format([RecordID], "00000") AS Whatever FROM SomeTable
In this example, you could not refer to the field as 'RecordID'. You could
read it using the alias ('Whatever' in the example above) but to write to it
you'd need to add an additional reference to the actual field to the query
....
SELECT RecordID, Format([RecordID], "00000") AS Whatever FROM SomeTable
If this doesn't enable you to resolve the problem, try posting the SQL for
the query, I'm sure someone will be able to see what the problem is.
--
Brendan Reynolds
"Jwy" <(E-Mail Removed)> wrote in message
news:4343E0E6-50BD-44DE-93A3-(E-Mail Removed)...
> No, my Query does include the field.
>
> "Douglas J. Steele" wrote:
>
>> Is your form perhaps based on a query that doesn't include that field?
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>>
>> "Jwy" <(E-Mail Removed)> wrote in message
>> news:52948A10-4DF7-4572-88E2-(E-Mail Removed)...
>> >I am experiencing the same problem. I have a table field named RecordID
>> > which is not used on a form. When I try to use code:
>> >
>> > If Me.ProjectStatus = "Completed" Then
>> > Me.RecordID = "PZ"
>> > End If
>> >
>> > I get the error message "Method or Data Member not found" for RecordID.
>> >
>> > I can't see the field RecordID in the drop down box when entering the
>> > code,
>> > yet it is in the table.
>> >
>> > Why is this happening?
>> >
>> > All help is appreciated.
>> >
>> >
>> >
>> > "Chaim" wrote:
>> >
>> >> Sharon,
>> >>
>> >> Since you set stDocName in two consecutive statements, the value is
>> >> just
>> >> the
>> >> last value assigned. Where is stDocName being used? It shows up no
>> >> place
>> >> in
>> >> this piece of code. This is clearly not the entire event procedure.
>> >>
>> >> Have you run this with the debugger so that you know which Method or
>> >> Data
>> >> Member it is specifically complaining about?
>> >>
>> >> Maybe you should post all of the procedure and tell us what method or
>> >> data
>> >> member it is complaining about. Also, how do you have your combo box
>> >> (cmbMethodofPayment) set up? How many columns? Which is the bound
>> >> column?
>> >> What does its data source look like?
>> >>
>> >> Good Luck!
>> >> --
>> >> Chaim
>> >>
>> >>
>> >> "Sharon" wrote:
>> >>
>> >> > When I run the code below it gives me the error that Method or Data
>> >> > Member
>> >> > not found. I have compared the "frmExpenseReport" and they appear
>> >> > to
>> >> > be the
>> >> > same as the "frmPurchaseOrder" as far as properties, etc. I added
>> >> > the
>> >> > stDocName = "frmPurchaseOrder" because when the drop down opens the
>> >> > name
>> >> > PurchaseOrderID doesn't show, but the PurchaseOrderID_Label does?
>> >> > Why?
>> >> > How do I fix this? What I am trying to do is that when the button
>> >> > is
>> >> > clicked, depending on the value selected in another combo box, I
>> >> > want
>> >> > it to
>> >> > open either one form (frmExpenseReport) or another
>> >> > (frmPurchaseOrder).
>> >> > Thanks for any help.
>> >> >
>> >> > Private Sub VIEW_REPORT_Click()
>> >> > On Error GoTo Err_VIEW_EXPENSE_REPORT_Click
>> >> >
>> >> > Dim stDocName As String
>> >> > Dim stLinkCriteria As String
>> >> >
>> >> > stDocName = "frmExpenseReport"
>> >> > stDocName = "frmPurchaseOrder"
>> >> >
>> >> > If Me!cmbMethodofPayment = 1 Then
>> >> > DoCmd.OpenForm "frmExpenseReport", , , "ExpenseReportID = " &
>> >> > Me.ExpenseReportID
>> >> >
>> >> > ElseIf Me!cmbMethodofPayment = 2 Then
>> >> > DoCmd.OpenForm "frmExpenseReport", , , "ExpenseReportID = "
>> >> > &
>> >> > Me.ExpenseReportID
>> >> >
>> >> > ElseIf Me!cmbMethodofPayment = 3 Then
>> >> > DoCmd.OpenForm "frmExpenseReport", , , "ExpenseReportID = "
>> >> > &
>> >> > Me.ExpenseReportID
>> >> >
>> >> > ElseIf Me!cmbMethodofPayment = 4 Then
>> >> > DoCmd.OpenForm "frmPurchaseOrder", , , "PurchaseOrderID = "
>> >> > &
>> >> > Me.PurchaseOrderID
>> >> >
>> >> > End If
>> >> >
>> >> >
>> >> >
>> >> > -
>> >> > S
>>
>>
>>