 |
|
 |
|
Next: Using object in function
|
| Author |
Message |
External

Since: Feb 12, 2005 Posts: 2
|
(Msg. 1) Posted: Sat Feb 12, 2005 11:07 am
Post subject: Getting at access feilds indirectly Archived from groups: microsoft>public>vb>database (more info?)
|
|
|
Hi,
I'm trying to build a generic routine that will load a combobox from a
table:
Public Sub Load_Class(InCntl As ComboBox, s_Table As String, s_Item_Name As
String, s_Index_Name As String)
Dim ss_Temp As Recordset
On Error GoTo 0
If Not f_db_Comics_Open Then
' Open Database and Recordsets
Set db_Comics = OpenDatabase(LocDataPath & dbaseName)
f_db_Comics_Open = True
End If
SQL = "Select * From " & s_Table & " Order By " & s_Item_Name
Set ss_Temp = db_Comics.OpenRecordset(SQL, dbOpenSnapshot)
L1 = 1
cls_cb_Load.Num_Entries = ss_Temp.RecordCount
InCntl.Clear
InCntl.AddItem s_Table
InCntl.ItemData(0) = 0
Do Until ss_Temp.EOF
InCntl.AddItem ss_Temp.Fields![s_Item_Name]
InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
ss_Temp.MoveNext
L1 = L1 + 1
Loop
InCntl.ListIndex = 0
On Error Resume Next
ss_Temp.Close
End Sub
My problem is I can't find a method to address the fields indirectly:
InCntl.AddItem ss_Temp.Fields![s_Item_Name]
InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
These don't work, and none of the variations I've tried work.
Any help appreciated,
David
--
"We Are Grey. We stand between the dark and the light." >> Stay informed about: Getting at access feilds indirectly |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 2) Posted: Sat Feb 12, 2005 1:08 pm
Post subject: Re: Getting at access feilds indirectly [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Try:
ss_Temp.Fields("s_Item_Name").Value
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a rel="nofollow" style='text-decoration: none;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"David B. Elson" wrote in message
> Hi,
>
> I'm trying to build a generic routine that will load a combobox from a
> table:
>
> Public Sub Load_Class(InCntl As ComboBox, s_Table As String, s_Item_Name
As
> String, s_Index_Name As String)
>
> Dim ss_Temp As Recordset
>
> On Error GoTo 0
> If Not f_db_Comics_Open Then
> ' Open Database and Recordsets
> Set db_Comics = OpenDatabase(LocDataPath & dbaseName)
> f_db_Comics_Open = True
> End If
>
> SQL = "Select * From " & s_Table & " Order By " & s_Item_Name
> Set ss_Temp = db_Comics.OpenRecordset(SQL, dbOpenSnapshot)
> L1 = 1
> cls_cb_Load.Num_Entries = ss_Temp.RecordCount
> InCntl.Clear
> InCntl.AddItem s_Table
> InCntl.ItemData(0) = 0
>
> Do Until ss_Temp.EOF
> InCntl.AddItem ss_Temp.Fields![s_Item_Name]
> InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
> ss_Temp.MoveNext
> L1 = L1 + 1
> Loop
> InCntl.ListIndex = 0
>
> On Error Resume Next
> ss_Temp.Close
>
> End Sub
>
>
> My problem is I can't find a method to address the fields indirectly:
>
> InCntl.AddItem ss_Temp.Fields![s_Item_Name]
> InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
>
> These don't work, and none of the variations I've tried work.
>
> Any help appreciated,
> David
>
>
>
>
>
> --
> "We Are Grey. We stand between the dark and the light."
>
> >> Stay informed about: Getting at access feilds indirectly |
|
| Back to top |
|
 |  |
External

Since: Feb 12, 2005 Posts: 2
|
(Msg. 3) Posted: Sat Feb 12, 2005 1:40 pm
Post subject: Re: Getting at access feilds indirectly [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Chris,
Thanks, it's a charm once the quotes are removed. Since the design of the
db is now pretty static, it beats the hell out of iterating through the
tabledefs object all the time.
Thanks again
David
"Veign" wrote in message
> Try:
> ss_Temp.Fields("s_Item_Name").Value
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
<font color=purple> > <a rel="nofollow" style='text-decoration: none;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
> --
>
>> Hi,
>>
>> I'm trying to build a generic routine that will load a combobox from a
>> table:
>>
>> Public Sub Load_Class(InCntl As ComboBox, s_Table As String, s_Item_Name
> As
>> String, s_Index_Name As String)
>>
>> Dim ss_Temp As Recordset
>>
>> On Error GoTo 0
>> If Not f_db_Comics_Open Then
>> ' Open Database and Recordsets
>> Set db_Comics = OpenDatabase(LocDataPath & dbaseName)
>> f_db_Comics_Open = True
>> End If
>>
>> SQL = "Select * From " & s_Table & " Order By " & s_Item_Name
>> Set ss_Temp = db_Comics.OpenRecordset(SQL, dbOpenSnapshot)
>> L1 = 1
>> cls_cb_Load.Num_Entries = ss_Temp.RecordCount
>> InCntl.Clear
>> InCntl.AddItem s_Table
>> InCntl.ItemData(0) = 0
>>
>> Do Until ss_Temp.EOF
>> InCntl.AddItem ss_Temp.Fields![s_Item_Name]
>> InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
>> ss_Temp.MoveNext
>> L1 = L1 + 1
>> Loop
>> InCntl.ListIndex = 0
>>
>> On Error Resume Next
>> ss_Temp.Close
>>
>> End Sub
>>
>>
>> My problem is I can't find a method to address the fields indirectly:
>>
>> InCntl.AddItem ss_Temp.Fields![s_Item_Name]
>> InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
>>
>> These don't work, and none of the variations I've tried work.
>>
>> Any help appreciated,
>> David
>>
>>
>>
>>
>>
>> --
>> "We Are Grey. We stand between the dark and the light."
>>
>>
>
> >> Stay informed about: Getting at access feilds indirectly |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 4) Posted: Sat Feb 12, 2005 3:23 pm
Post subject: Re: Getting at access feilds indirectly [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Oops....Didn't look close enough to see it was a variable...
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a rel="nofollow" style='text-decoration: none;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"David B. Elson" wrote in message
> Chris,
>
> Thanks, it's a charm once the quotes are removed. Since the design of the
> db is now pretty static, it beats the hell out of iterating through the
> tabledefs object all the time.
>
> Thanks again
> David
>
> > Try:
> > ss_Temp.Fields("s_Item_Name").Value
> >
> > --
> > Chris Hanscom - Microsoft MVP (VB)
> > Veign's Resource Center
<font color=green> > > <a rel="nofollow" style='text-decoration: none;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
> > --
> >
> >> Hi,
> >>
> >> I'm trying to build a generic routine that will load a combobox from a
> >> table:
> >>
> >> Public Sub Load_Class(InCntl As ComboBox, s_Table As String,
s_Item_Name
> > As
> >> String, s_Index_Name As String)
> >>
> >> Dim ss_Temp As Recordset
> >>
> >> On Error GoTo 0
> >> If Not f_db_Comics_Open Then
> >> ' Open Database and Recordsets
> >> Set db_Comics = OpenDatabase(LocDataPath & dbaseName)
> >> f_db_Comics_Open = True
> >> End If
> >>
> >> SQL = "Select * From " & s_Table & " Order By " & s_Item_Name
> >> Set ss_Temp = db_Comics.OpenRecordset(SQL, dbOpenSnapshot)
> >> L1 = 1
> >> cls_cb_Load.Num_Entries = ss_Temp.RecordCount
> >> InCntl.Clear
> >> InCntl.AddItem s_Table
> >> InCntl.ItemData(0) = 0
> >>
> >> Do Until ss_Temp.EOF
> >> InCntl.AddItem ss_Temp.Fields![s_Item_Name]
> >> InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
> >> ss_Temp.MoveNext
> >> L1 = L1 + 1
> >> Loop
> >> InCntl.ListIndex = 0
> >>
> >> On Error Resume Next
> >> ss_Temp.Close
> >>
> >> End Sub
> >>
> >>
> >> My problem is I can't find a method to address the fields indirectly:
> >>
> >> InCntl.AddItem ss_Temp.Fields![s_Item_Name]
> >> InCntl.ItemData(L1) = ss_Temp![s_Index_Name]
> >>
> >> These don't work, and none of the variations I've tried work.
> >>
> >> Any help appreciated,
> >> David
> >>
> >>
> >>
> >>
> >>
> >> --
> >> "We Are Grey. We stand between the dark and the light."
> >>
> >>
> >
> >
>
> >> Stay informed about: Getting at access feilds indirectly |
|
| Back to top |
|
 |  |
| Related Topics: | Cannot Delete Pocket Access File - I'm creating a Pocket Access file (via an EVB application) on a mobile device running PPC 2002. When the user logs off the EVB application, I want to delete the Access file (stored in the /Temp folder). However, I am unable to do this because the..
Access 2002 Automation problem with OpenReport - My VB 6 application needs to print a report in an Access 2002 database. This was working fine when I used Access 97 but now the application quits without any errors on the DoCmd.OpenReport line. I have my VB application references set to access 10.0. ....
sql query returns in wrong format - Hi, Hope someone can help me with this. I have MS SQL 2000 database where i have Table "PriceList" and there a column "Pricemk" wich is data type "money". All data in this column is in form "10001,35". So why when...
arrays - is there a way to concatenate the contents of an array (looping through the array) and storing each item in a comma delimited string? Thanks!
DataReport PageBreak - Hi everyone, I would like to know how to force pagebreak in a datareport for example after 5 records printed. Thank you all |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|