Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using RowSource Property for a ComboBox In Word

830 views
Skip to first unread message

Missy Mason

unread,
Sep 18, 2003, 9:30:51 PM9/18/03
to
Hi,

I have an Excel document that contains information that I want to use as my
rowsource for my combobox in Word. When I create a UserForm in Excel with a
combobox and try it, the string below works , but when I create a UserForm
in Word with a combo box, I get the error message "invalid property value".
The string I am trying to enter into rowsource property is listed below:

='C:\Backup\[Test Combo box.xls]Sheet1'!LastName

Any help on the proper way to enter this would be appreciated.

Missy Mason


Doug Robbins - Word MVP

unread,
Sep 19, 2003, 6:13:03 AM9/19/03
to
Hi Missy,

See the article “Load a ListBox from a Named Range in Excel using DAO” at:

http://www.mvps.org/word/FAQs/InterDev/FillListBoxFromXLDAO.htm

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
"Missy Mason" <news...@shaw.ca> wrote in message
news:f%sab.982237$ro6.19...@news2.calgary.shaw.ca...

Missy Mason

unread,
Sep 19, 2003, 10:01:00 AM9/19/03
to
Hi,

I tried the DAO method, but it came back within invalid query string.

"Doug Robbins - Word MVP" <d...@mvps.org> wrote in message
news:#z0Teapf...@TK2MSFTNGP09.phx.gbl...

Doug Robbins - Word MVP

unread,
Sep 21, 2003, 5:01:26 AM9/21/03
to
Hi Missy,

I just tried it and it works fine for me.

Post back to the newsgroup with a message into which you paste the exact
code that you have tried to use.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
"Missy Mason" <news...@shaw.ca> wrote in message

news:w_Dab.995032$3C2.22...@news3.calgary.shaw.ca...

Missy Mason

unread,
Sep 21, 2003, 3:06:54 PM9/21/03
to
Hi,

I have attached the exact code that I am using. I have created a
spreadsheet called Test Combo box with a range called LastName (A1:A3).
When I run the code I get the error message: Syntax error in query.
Incomplete query clause.

Any help as to what I am doing incorrectly, would be greatly appreciated.


Dim db As DAO.database
Dim rs As DAO.recordset
Dim NoOfRecords As Long
' Open the database
Set db = OpenDatabase("c:\backup\Test Combo box.xls", False, False, "Excel
8.0")

' Retrieve the recordset
Set rs = db.OpenRecordset("Select * from 'LastName'")
' Determine the number of retrieved records
With rs
.MoveLast
NoOfRecords = .RecordCount
.MoveFirst
End With
' Set the number of columns - number of fields in recordset
Me.cmbxLawyer.ColumnCount = rs.Fields.Count
' Load the Combobox with the retrieved records
Me.cmbxLawyer.Column = rs.GetRows(NoOfRecords)

rs.Close
db.Close


Missy Mason

"Doug Robbins - Word MVP" <d...@mvps.org> wrote in message

news:#RyBx7Bg...@tk2msftngp13.phx.gbl...

Doug Robbins - Word MVP

unread,
Sep 21, 2003, 7:45:21 PM9/21/03
to
Hi Missy,

Change this line:

Set rs = db.OpenRecordset("Select * from 'LastName'")

to

Set rs = db.OpenRecordset("Select * from LastName")

no apostrophes around the name of the range.

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
"Missy Mason" <news...@shaw.ca> wrote in message

news:iFmbb.199253$la.39...@news1.calgary.shaw.ca...

Missy Mason

unread,
Sep 22, 2003, 12:29:28 AM9/22/03
to
Hi,

Thank you so much. It works!!

Regards,


Missy Mason

"Doug Robbins - Word MVP" <d...@mvps.org> wrote in message

news:eaTZspJg...@tk2msftngp13.phx.gbl...

0 new messages