Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Getting at access feilds indirectly

 
   Database Help (Home) -> Visual Basic RSS
Related Topics:
Cannot Delete Pocket Access File - I'm creating a Pocket Access file (via an EVB on a mobile device running PPC 2002. When the user logs off the EVB 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 needs to print a report in an Access 2002 database. This was working fine when I used Access 97 but now the quits without any errors on the line. I have my VB 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 and there a column wich is data type All data in this column is in form So why when i run .asp page with simple query to..

arrays - is there a way to 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 for example after 5 records printed. Thank you all
Next:  Using object in function  
Author Message
David B. Elson

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
Login to vote
Veign2

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 style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--

"David B. Elson" <david.elson.DeleteThis@sympatico.ca> wrote in message
news:ZYoPd.34256$Ub4.1547141@news20.bellglobal.com...
 > 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."
 >
 ><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Getting at access feilds indirectly 
Back to top
Login to vote
David B. Elson

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" <NOSPAMinveign DeleteThis @veign.com> wrote in message
news:O7IDaYSEFHA.3824@TK2MSFTNGP10.phx.gbl...
 > Try:
 > ss_Temp.Fields("s_Item_Name").Value
 >
 > --
 > Chris Hanscom - Microsoft MVP (VB)
 > Veign's Resource Center
<font color=purple> > <a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
 > --
 >
 > "David B. Elson" <david.elson DeleteThis @sympatico.ca> wrote in message
 > news:ZYoPd.34256$Ub4.1547141@news20.bellglobal.com...
  >> 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."
  >>
  >>
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Getting at access feilds indirectly 
Back to top
Login to vote
Veign2

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 style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--

"David B. Elson" <david.elson.RemoveThis@sympatico.ca> wrote in message
news:MprPd.35179$Ub4.1585087@news20.bellglobal.com...
 > 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" <NOSPAMinveign.RemoveThis@veign.com> wrote in message
 > news:O7IDaYSEFHA.3824@TK2MSFTNGP10.phx.gbl...
  > > Try:
  > > ss_Temp.Fields("s_Item_Name").Value
  > >
  > > --
  > > Chris Hanscom - Microsoft MVP (VB)
  > > Veign's Resource Center
<font color=green>  > > <a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
  > > --
  > >
  > > "David B. Elson" <david.elson.RemoveThis@sympatico.ca> wrote in message
  > > news:ZYoPd.34256$Ub4.1547141@news20.bellglobal.com...
   > >> 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."
   > >>
   > >>
  > >
  > >
 >
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Getting at access feilds indirectly 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> Visual Basic All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
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



[ Contact us | Terms of Service/Privacy Policy ]