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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR: Record Source specified does not exist...

Status
Not open for further replies.

Emmali

Programmer
Jul 30, 2003
29
US
Exact error message:

Record Source 'SELECT
.[field] FROM
;' specified on this form or report does not exist.

... and for all I can see, it does:



'Heading Column PName
PNameFieldValues = "PracticionerID; Name"
Call LoadPractitionerName(0)
Me!lbxPName.RowSourceType = "Table/Query"
Me!lbxPName.RowSource = PNameFieldValues
Me!lbxPName.ColumnCount = 1
Me!lbxPName.ColumnHeads = False

Private Sub LoadPName(PID)
Dim db As Database, rs As Recordset, strSql As String
Dim pnNewID As String

'Check for the bottom of the tree
If IsNull(PID) Then
Exit Sub
End If

Set db = CurrentDb()
strSql = "select name from [practitioner contact info] where practitionerid=" & PracticionerID
Set rs = db.OpenRecordset(strSql)

Do While Not rs.EOF
PNameFieldValues = PNameFieldValues & PracticionerID & ";" & rs("practitionerid") & ";" & rs("test") & ";"
'Recursive call to check for children
Call LoadPName(rs("practitionerid"))
rs.MoveNext
Loop

If Not rs Is Nothing Then
rs.Close
End If
Set rs = Nothing

End Sub






Center for World Indigenous Studies

"Always carry a tuna sandwich in case of tigers."
 
Hi Emmali,

I'm a bit confused by this.

You have set the RowSourceType (of lbxPName) to "Query/Table". This means that you should have valid SQL in the RowSource. Assuming that Sub LoadPName is in fact the routine you mean to call with the LoadPractitionerName(0) statement, you seem to be building up a Value List in your code which would cause an error, but ..

.. the error message shows what appears to be valid SQL, which appears to have nothing to do with the code. It looks as though you have typed the error message in (do you really have Table and Field as names?) and all I can think of is that you may perhaps have a space in front of "SELECT" which might trigger the message.

If there is something else you have not posted which might make it clearer, please come back.

Enjoy,
Tony
 
Tony,

Yes, I typed in the error message - I can't copy it from the dialogue box.

No, of course I don't have
.[field], but I did most of the design with *shudder* wizards in the interest of time, and now I am paying for it with the poor layouts and naming.... (I'm really a web programmer who got roped into this 'cause I know VB. Ack.) I didn't want to (possibly incorrectly in my dyslexic delusions) type: [practitioner contact info].[name]

I fixed the LoadPractitionerName(0) to LoadPName, and its cbxPName now that its a combo box.

I don't find an extra space, but I've been flipping back and forth between Design View Properties & Query Builder (ick) and the code window.

Why would "building up a Value List in my code" cause an error?

Oh, and the combo box doesn't have a Row Source, but only the Record Source which has the SQL statement as previously stated.

Any ideas?

Thanks, Emm
 
Hi Emm,

All I was realy trying to say was that there was nothing obviously wrong so had you perhaps not copied the error message exactly.

There is nothing wrong with building up a Value List. But if you have a value list you must set RowSourceType to "Value List" and not "Table/Query".

The error message says "Record Source" but it refers to a combo's RowSource property. The RowSource you are building is not SQL so do you have two different combos? There is something I don't understand here and I'm not sure how to help any more at the moment.

I'm off out shortly and don't expect to be back till tomorrow night but I will check back then to see if you have a solution.

Enjoy,
Tony
 
Forms have RecordSource
Combo and List boxes have RowSource

As Tony said, try replacing:

Me!lbxPName.RowSourceType = "Table/Query"
with
Me!lbxPName.RowSourceType = "Value List"

If still doesn't work, run the code step by step and see where it breaks.

Good luck



[pipe]
Daniel Vlas
Systems Consultant

 
Hey all,
Here's a question:
I have one combo box that works properly; it's not the only one in the subform, and its pertinant properties (in the box) are:

Row Source Type Table/Query
Row Source SELECT [Test].[Test] FROM Test;

I have a table by such name (my original attempt at creating the Row Source), as I have small tables for the other select data. I have tried changing it to Value List, and that just makes it worse.

I think I have to change my Control Source to match that of the field in the data storage table...

hrm, that doesn't seem to help the other one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top