From askolits at ot.com Thu Jan 1 22:00:00 2004 From: askolits at ot.com (John Skolits) Date: Thu, 1 Jan 2004 23:00:00 -0500 Subject: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 In-Reply-To: <5B898D9F0627974EB82D0645E52B1E7D035CB9AD@EXMBPR03.na.mmfg.net> Message-ID: Here's a DAO procedure, but I think Lorraine's ADO method is better. John --------------- Function SqlServerSP_Test() 'This will essentially create a pass-thru query Dim strODBCConnection As String 'Store the ODBC connect string into a variable strODBCConnection = "ODBC;DRIVER={SQL Server};SERVER=DatabaseSERVERName;UID=SA;PWD=MyPassword;DATABASE=SQL_DATABAS EName" 'Create a query def object Dim MyQry As DAO.QueryDef Set MyQry = CurrentDb().CreateQueryDef("") 'no need to give it a name since it's just a temporary object 'If you do give it a name, it will be saved in your database window as a pass-thru query. 'Set the connection string MyQry.Connect = strODBCConnection 'Timeout is typically 60 seconds. If you think it may take a while to run, 'increase it accordingly. Otherwise, an error may occur MyQry.ODBCTimeout = 120 MyQry.ReturnsRecords = False 'If not returning records, set to false 'Set the sql statement of the query def to be the stored procedure. 'Include the EXECUTE command MyQry.SQL = "EXECUTE SP_MyStoredProcedure" 'You can also pass an argument. Make sure these is a space after the SP before adding the argument MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "45" 'Passing a numeric value MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "'Hello'" 'Passing a string 'Now execute the query MyQry.Execute 'Use this when not returning records 'Close your query def object MyQry.Close End Function ---------------------- -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Christian, Lorraine Sent: Wednesday, December 31, 2003 1:16 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 Hi there! Not be near my source code. Would something like this help? Public Sub AutoNumber() Dim cmd As New ADODB.Command cmd.ActiveConnection = myConn2 cmd.CommandType = adCmdStoredProc cmd.CommandText = "NBPHI.NEXT_INTVW_ID_NR" cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Execute iErrorResponse = cmd.Parameters(0).Value If cmd.Parameters(0).Value = 0 Then intKey = cmd.Parameters(1).Value Else MsgBox "An error occured creating this record. Contact your support", vbCritical End If End Sub HTHs Lorraine Happy New Year -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Francisco H Tapia Sent: Wednesday, December 31, 2003 12:35 PM To: paul.hartland at fsmail.net; dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 paul.hartland at fsmail.net wrote: >To all, > >I am currently writing a visual basic application with which the back-end will be on SQL Server 7.0. I currently have a data environment with a command object that links to a stored procedure on the SQL Server. What I want to be able to do is do away with the DataEnvironment and execute the stored procedure from a module and pass the results (i.e. if I had a SELECT SP into a recordset. > >Anyone any ideas how to do this. > >Thanks in advance. > >Paul Hartland > > Use ADO. for help on ADO check your online help, MSDN or http://www.able-consulting.com/tech.htm -- -Francisco _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From paul.hartland at fsmail.net Fri Jan 9 04:24:13 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Fri, 9 Jan 2004 11:24:13 +0100 (CET) Subject: [dba-VB] Multiple-step operation generated errors - check each status value Message-ID: <21241280.1073643853716.JavaMail.www@wwinf3002> To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From ebarro at afsweb.com Fri Jan 9 09:11:02 2004 From: ebarro at afsweb.com (Eric Barro) Date: Fri, 9 Jan 2004 07:11:02 -0800 Subject: [dba-VB] Multiple-step operation generated errors - check each status value In-Reply-To: <21241280.1073643853716.JavaMail.www@wwinf3002> Message-ID: Paul, Check the record lock type you defined for the recordset. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of paul.hartland at fsmail.net Sent: Friday, January 09, 2004 2:24 AM To: dba-vb Cc: accessd Subject: [dba-VB] Multiple-step operation generated errors - check each status value To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 From R.Griffiths at bury.gov.uk Tue Jan 20 09:30:58 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 15:30:58 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Hi Group Having problems trying to code a tabstrip click i.e. code to change the tab - can't seem to be able to find the correct method. Any ideas Thanks Richard From sgsax at ksu.edu Tue Jan 20 10:30:12 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Tue, 20 Jan 2004 10:30:12 -0600 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: References: Message-ID: <1074616212.25787.44.camel@sgsax-th4022.ksu.edu> Richard, Use the SetFocus method of the page to simulate clicking on the tab. Tab control pages can be named, like any other control. Here's some code: tabMyTabControl.Pages("pgeMyPage").SetFocus A page can be identifed by its name or index value. Seth On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > > Thanks > Richard > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From R.Griffiths at bury.gov.uk Tue Jan 20 10:43:57 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 16:43:57 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From LChristian at MassMutual.com Tue Jan 20 12:29:09 2004 From: LChristian at MassMutual.com (Christian, Lorraine) Date: Tue, 20 Jan 2004 13:29:09 -0500 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <5B898D9F0627974EB82D0645E52B1E7D035CBB40@EXMBPR03.na.mmfg.net> Hi there How about: Private Sub Form_Load() ' Sets focus to the first tab on the Main tab control and ' sets focus to the second tab on the Initial tab control SSTabMain.Tab = 0 SSTabInitial.Tab = 1 End Sub OR Private Sub SSTabInitial_Click(PreviousTab As Integer) Select Case PreviousTab Case 0 ' Personal Data Do something Case 1 ' Citizenship/Insurance Status Do something End Select End Sub HTH, Lorraine -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, Richard Sent: Tuesday, January 20, 2004 11:44 AM To: 'dba-vb at databaseadvisors.com' Subject: RE: [dba-VB] Tabstrip Control - VB6 Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- From stuart at lexacorp.com.pg Tue Jan 20 16:58:22 2004 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Wed, 21 Jan 2004 08:58:22 +1000 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: Message-ID: <400E3F2E.20767.21AF79@localhost> On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From paul.hartland at fsmail.net Wed Jan 21 03:14:29 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 21 Jan 2004 10:14:29 +0100 (CET) Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <2873815.1074676469264.JavaMail.www@wwinf3006> Stuart, I used to use the tabstrip control with frames to hold the controls, so when you click a tab you hide one frame and show another etc. But we recently purchased Infragistics NetAdvantage Suite (mainly for it's datagrid (UltraGrid) control), and it has lots of other very good controls one being a tab form along with a tabpanel. You place the tabform on your screen and then for each tab you add a tab panel, and infragistics does the rest. Hope that helps............ Paul Hartland Message date : Jan 20 2004, 11:16 PM >From : "Stuart McLachlan" To : dba-vb at databaseadvisors.com Copy to : Subject : Re: [dba-VB] Tabstrip Control - VB6 On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From R.Griffiths at bury.gov.uk Thu Jan 22 02:58:33 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Thu, 22 Jan 2004 08:58:33 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Lorraine you set me on the right path to get it working, which is .... TabStrip.tabs(Tabindex).selected = x (note there are at least 2 MS tab controls (SSTab and TabStrip) which is why some of th offered solutions did not work ) Thanks for all contributions Richard > -----Original Message----- > From: Christian, Lorraine [SMTP:LChristian at MassMutual.com] > Sent: 20 January 2004 18:29 > To: dba-vb at databaseadvisors.com > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > Hi there > > How about: > > Private Sub Form_Load() > > ' Sets focus to the first tab on the Main tab control and > ' sets focus to the second tab on the Initial tab control > > SSTabMain.Tab = 0 > SSTabInitial.Tab = 1 > > End Sub > > OR > > Private Sub SSTabInitial_Click(PreviousTab As Integer) > > > Select Case PreviousTab > > Case 0 ' Personal Data > Do something > > Case 1 ' Citizenship/Insurance Status > Do something > > End Select > > End Sub > > > HTH, > Lorraine > -----Original Message----- > From: dba-vb-bounces at databaseadvisors.com > [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, > Richard > Sent: Tuesday, January 20, 2004 11:44 AM > To: 'dba-vb at databaseadvisors.com' > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > > Seth > > the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have > this > propery/method .Pages > > Richard > > > > > -----Original Message----- > > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > > Sent: 20 January 2004 16:30 > > To: dba-vb at databaseadvisors.com > > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > > > Richard, > > > > Use the SetFocus method of the page to simulate clicking on the tab. > > Tab control pages can be named, like any other control. Here's some > > code: > > > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > > > A page can be identifed by its name or index value. > > > > Seth > > > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > > Hi Group > > > > > > Having problems trying to code a tabstrip click i.e. code to change > the > > tab > > > - can't seem to be able to find the correct method. > > > Any ideas > > > > > > Thanks > > > Richard > > > > > > > -- > > Seth Galitzer sgsax at ksu.edu > > Computing Specialist http://puma.agron.ksu.edu/~sgsax > > Dept. of Plant Pathology > > Kansas State University > > > > _______________________________________________ > > dba-VB mailing list > > dba-VB at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-vb > > http://www.databaseadvisors.com > > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > > --------------------------------------------------------- > This e-mail transmission may contain information that is proprietary, > privileged and/or confidential and is intended exclusively for the > person(s) to whom it is addressed. Any use, copying, retention or > disclosure by any person other than the intended recipient or the intended > recipient's designees is strictly prohibited. If you are not the intended > recipient or their designee, please notify the sender immediately by > return e-mail and delete all copies. > > --------------------------------------------------------- > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From bkollodge at parkindustries.com Tue Jan 27 09:27:18 2004 From: bkollodge at parkindustries.com (bkollodge at parkindustries.com) Date: Tue, 27 Jan 2004 09:27:18 -0600 Subject: [dba-VB] Cursor control Message-ID: Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering From paul.hartland at fsmail.net Tue Jan 27 09:52:19 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 27 Jan 2004 16:52:19 +0100 (CET) Subject: [dba-VB] Cursor control Message-ID: <2473302.1075218739278.JavaMail.www@wwinf3005> To Bill, Hopefully this should get you started in the right direction Public pubCursor As Integer Private Sub cmdLeft_Click() Me.Text0.SetFocus If (pubCursor > 0) Then pubCursor = pubCursor - 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub cmdRight_Click() Me.Text0.SetFocus If (pubCursor < Len(Trim(Me.Text0))) Then pubCursor = pubCursor + 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub Form_Open(Cancel As Integer) pubCursor = 0 End Sub Private Sub Text0_GotFocus() Me.Text0.SelStart = pubCursor End Sub The Text0_GotFocus moves the cursor to the last position known to pubCursor, then the cmdLeft & cmdRight buttons move the cursor to either the left or right of the last position. Paul Message date : Jan 27 2004, 03:29 PM >From : bkollodge at parkindustries.com To : dba-VB at databaseadvisors.com Copy to : Subject : [dba-VB] Cursor control Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From paul.hartland at fsmail.net Wed Jan 28 03:28:17 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 28 Jan 2004 10:28:17 +0100 (CET) Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <13710544.1075282097676.JavaMail.www@wwinf3005> To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields ? Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I?m using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From sgsax at ksu.edu Wed Jan 28 08:09:25 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Wed, 28 Jan 2004 08:09:25 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 In-Reply-To: <13710544.1075282097676.JavaMail.www@wwinf3005> References: <13710544.1075282097676.JavaMail.www@wwinf3005> Message-ID: <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Paul, Have a look at the downloads on my website. I have sample code for file I/O in VB. The code was written for Access, but is generic enough it should work in VB without a problem. I use DAO in there for database access, but you can easily substitue ADO if you prefer. Seth On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > To all, > > Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. > > My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). > > The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. > > Thanks in advance for any help as, this project needs to be ready for Monday morning > > Paul Hartland > Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month > www.freeserve.com/anytime -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From martyconnelly at shaw.ca Wed Jan 28 10:39:07 2004 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 28 Jan 2004 08:39:07 -0800 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 References: <13710544.1075282097676.JavaMail.www@wwinf3005> <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Message-ID: <4017E5AB.4090000@shaw.ca> For a quick and dirty on a csv text file. With a Jet install you should have access to TEXT OLEDB Provider Then oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\somepath\;" & _ "Extended Properties=""text;HDR=Yes;FMT=Delimited""" The HDR = Yes indicates Column names are included in the file. 'Then open a recordset based on a select on the actual file oRs.Open "Select * From MyTextFile.txt", oConn, _ adOpenStatic, adLockReadOnly, adCmdText See HOWTO: Open Delimited Text Files Using the Jet Provider's Text IIsam http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q262/5/37.ASP&NoWebContent=1 and http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJetText Seth Galitzer wrote: >Paul, > >Have a look at the downloads on my website. I have sample code for file >I/O in VB. The code was written for Access, but is generic enough it >should work in VB without a problem. I use DAO in there for database >access, but you can easily substitue ADO if you prefer. > >Seth > >On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > > >>To all, >> >>Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. >> >>My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). >> >>The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. >> >>Thanks in advance for any help as, this project needs to be ready for Monday morning >> >>Paul Hartland >>Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month >>www.freeserve.com/anytime >> >> > > > -- Marty Connelly Victoria, B.C. Canada From JRojas at tnco-inc.com Wed Jan 28 12:21:03 2004 From: JRojas at tnco-inc.com (Joe Rojas) Date: Wed, 28 Jan 2004 13:21:03 -0500 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <806536912C472E4A9D6515DF2E57261E2396A6@mercury.tnco-inc.com> Do you HAVE to use VB to do this? Can you just use Access and do a File -> Get External Data -> Import? This would be much easier, IMO. JR -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 4:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com This electronic transmission is strictly confidential to TNCO, Inc. and intended solely for the addressee. It may contain information which is covered by legal, professional, or other privileges. If you are not the intended addressee, or someone authorized by the intended addressee to receive transmissions on behalf of the addressee, you must not retain, disclose in any form, copy, or take any action in reliance on this transmission. If you have received this transmission in error, please notify the sender as soon as possible and destroy this message. While TNCO, Inc. uses virus protection, the recipient should check this email and any attachments for the presence of viruses. TNCO, Inc. accepts no liability for any damage caused by any virus transmitted by this email. From DWUTKA at marlow.com Wed Jan 28 13:37:30 2004 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 28 Jan 2004 13:37:30 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <2F8793082E00D4119A1700B0D0216BF8022277D9@main2.marlow.com> Assuming you're text file looks like this: 12354324532,$3.15 53243242341,$4.25 (where there is a carriage return line feed between each record) you could do this: Dim f as Long Dim strTemp as string dim RecordArray() as String dim FieldArray() as String dim rs As ADODB.Recordset dim cnn as ADODB.Connection dim strSQL as String dim i As Long f=FreeFile Open "C:\PathToFile\FileName.txt" for Binary Access Read As f strTemp=space(lof(f)) get f,,strTemp close f RecordArray=Split(strTemp, vbcrlf) Set cnn=new adodb.connection 'Connect to your mdb Set rs=new ADODB.Recordset strSQL="SELECT Barcode, Price FROM tblTableName" rs.open strsql,cnn,adopenkeyset, adLockOptimistic For i=0 to Ubound(RecordArray) FieldArray=Split(RecordArray(i),",") rs.AddNew rs.fields(0).value=fieldArray(0) rs.fields(1).value=FieldArray(1) rs.Update next i rs.close set rs=nothing cnn.close set cnn=nothing -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 3:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From askolits at ot.com Thu Jan 1 22:00:00 2004 From: askolits at ot.com (John Skolits) Date: Thu, 1 Jan 2004 23:00:00 -0500 Subject: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 In-Reply-To: <5B898D9F0627974EB82D0645E52B1E7D035CB9AD@EXMBPR03.na.mmfg.net> Message-ID: Here's a DAO procedure, but I think Lorraine's ADO method is better. John --------------- Function SqlServerSP_Test() 'This will essentially create a pass-thru query Dim strODBCConnection As String 'Store the ODBC connect string into a variable strODBCConnection = "ODBC;DRIVER={SQL Server};SERVER=DatabaseSERVERName;UID=SA;PWD=MyPassword;DATABASE=SQL_DATABAS EName" 'Create a query def object Dim MyQry As DAO.QueryDef Set MyQry = CurrentDb().CreateQueryDef("") 'no need to give it a name since it's just a temporary object 'If you do give it a name, it will be saved in your database window as a pass-thru query. 'Set the connection string MyQry.Connect = strODBCConnection 'Timeout is typically 60 seconds. If you think it may take a while to run, 'increase it accordingly. Otherwise, an error may occur MyQry.ODBCTimeout = 120 MyQry.ReturnsRecords = False 'If not returning records, set to false 'Set the sql statement of the query def to be the stored procedure. 'Include the EXECUTE command MyQry.SQL = "EXECUTE SP_MyStoredProcedure" 'You can also pass an argument. Make sure these is a space after the SP before adding the argument MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "45" 'Passing a numeric value MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "'Hello'" 'Passing a string 'Now execute the query MyQry.Execute 'Use this when not returning records 'Close your query def object MyQry.Close End Function ---------------------- -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Christian, Lorraine Sent: Wednesday, December 31, 2003 1:16 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 Hi there! Not be near my source code. Would something like this help? Public Sub AutoNumber() Dim cmd As New ADODB.Command cmd.ActiveConnection = myConn2 cmd.CommandType = adCmdStoredProc cmd.CommandText = "NBPHI.NEXT_INTVW_ID_NR" cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Execute iErrorResponse = cmd.Parameters(0).Value If cmd.Parameters(0).Value = 0 Then intKey = cmd.Parameters(1).Value Else MsgBox "An error occured creating this record. Contact your support", vbCritical End If End Sub HTHs Lorraine Happy New Year -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Francisco H Tapia Sent: Wednesday, December 31, 2003 12:35 PM To: paul.hartland at fsmail.net; dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 paul.hartland at fsmail.net wrote: >To all, > >I am currently writing a visual basic application with which the back-end will be on SQL Server 7.0. I currently have a data environment with a command object that links to a stored procedure on the SQL Server. What I want to be able to do is do away with the DataEnvironment and execute the stored procedure from a module and pass the results (i.e. if I had a SELECT SP into a recordset. > >Anyone any ideas how to do this. > >Thanks in advance. > >Paul Hartland > > Use ADO. for help on ADO check your online help, MSDN or http://www.able-consulting.com/tech.htm -- -Francisco _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From paul.hartland at fsmail.net Fri Jan 9 04:24:13 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Fri, 9 Jan 2004 11:24:13 +0100 (CET) Subject: [dba-VB] Multiple-step operation generated errors - check each status value Message-ID: <21241280.1073643853716.JavaMail.www@wwinf3002> To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From ebarro at afsweb.com Fri Jan 9 09:11:02 2004 From: ebarro at afsweb.com (Eric Barro) Date: Fri, 9 Jan 2004 07:11:02 -0800 Subject: [dba-VB] Multiple-step operation generated errors - check each status value In-Reply-To: <21241280.1073643853716.JavaMail.www@wwinf3002> Message-ID: Paul, Check the record lock type you defined for the recordset. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of paul.hartland at fsmail.net Sent: Friday, January 09, 2004 2:24 AM To: dba-vb Cc: accessd Subject: [dba-VB] Multiple-step operation generated errors - check each status value To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 From R.Griffiths at bury.gov.uk Tue Jan 20 09:30:58 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 15:30:58 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Hi Group Having problems trying to code a tabstrip click i.e. code to change the tab - can't seem to be able to find the correct method. Any ideas Thanks Richard From sgsax at ksu.edu Tue Jan 20 10:30:12 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Tue, 20 Jan 2004 10:30:12 -0600 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: References: Message-ID: <1074616212.25787.44.camel@sgsax-th4022.ksu.edu> Richard, Use the SetFocus method of the page to simulate clicking on the tab. Tab control pages can be named, like any other control. Here's some code: tabMyTabControl.Pages("pgeMyPage").SetFocus A page can be identifed by its name or index value. Seth On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > > Thanks > Richard > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From R.Griffiths at bury.gov.uk Tue Jan 20 10:43:57 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 16:43:57 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From LChristian at MassMutual.com Tue Jan 20 12:29:09 2004 From: LChristian at MassMutual.com (Christian, Lorraine) Date: Tue, 20 Jan 2004 13:29:09 -0500 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <5B898D9F0627974EB82D0645E52B1E7D035CBB40@EXMBPR03.na.mmfg.net> Hi there How about: Private Sub Form_Load() ' Sets focus to the first tab on the Main tab control and ' sets focus to the second tab on the Initial tab control SSTabMain.Tab = 0 SSTabInitial.Tab = 1 End Sub OR Private Sub SSTabInitial_Click(PreviousTab As Integer) Select Case PreviousTab Case 0 ' Personal Data Do something Case 1 ' Citizenship/Insurance Status Do something End Select End Sub HTH, Lorraine -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, Richard Sent: Tuesday, January 20, 2004 11:44 AM To: 'dba-vb at databaseadvisors.com' Subject: RE: [dba-VB] Tabstrip Control - VB6 Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- From stuart at lexacorp.com.pg Tue Jan 20 16:58:22 2004 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Wed, 21 Jan 2004 08:58:22 +1000 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: Message-ID: <400E3F2E.20767.21AF79@localhost> On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From paul.hartland at fsmail.net Wed Jan 21 03:14:29 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 21 Jan 2004 10:14:29 +0100 (CET) Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <2873815.1074676469264.JavaMail.www@wwinf3006> Stuart, I used to use the tabstrip control with frames to hold the controls, so when you click a tab you hide one frame and show another etc. But we recently purchased Infragistics NetAdvantage Suite (mainly for it's datagrid (UltraGrid) control), and it has lots of other very good controls one being a tab form along with a tabpanel. You place the tabform on your screen and then for each tab you add a tab panel, and infragistics does the rest. Hope that helps............ Paul Hartland Message date : Jan 20 2004, 11:16 PM >From : "Stuart McLachlan" To : dba-vb at databaseadvisors.com Copy to : Subject : Re: [dba-VB] Tabstrip Control - VB6 On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From R.Griffiths at bury.gov.uk Thu Jan 22 02:58:33 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Thu, 22 Jan 2004 08:58:33 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Lorraine you set me on the right path to get it working, which is .... TabStrip.tabs(Tabindex).selected = x (note there are at least 2 MS tab controls (SSTab and TabStrip) which is why some of th offered solutions did not work ) Thanks for all contributions Richard > -----Original Message----- > From: Christian, Lorraine [SMTP:LChristian at MassMutual.com] > Sent: 20 January 2004 18:29 > To: dba-vb at databaseadvisors.com > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > Hi there > > How about: > > Private Sub Form_Load() > > ' Sets focus to the first tab on the Main tab control and > ' sets focus to the second tab on the Initial tab control > > SSTabMain.Tab = 0 > SSTabInitial.Tab = 1 > > End Sub > > OR > > Private Sub SSTabInitial_Click(PreviousTab As Integer) > > > Select Case PreviousTab > > Case 0 ' Personal Data > Do something > > Case 1 ' Citizenship/Insurance Status > Do something > > End Select > > End Sub > > > HTH, > Lorraine > -----Original Message----- > From: dba-vb-bounces at databaseadvisors.com > [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, > Richard > Sent: Tuesday, January 20, 2004 11:44 AM > To: 'dba-vb at databaseadvisors.com' > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > > Seth > > the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have > this > propery/method .Pages > > Richard > > > > > -----Original Message----- > > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > > Sent: 20 January 2004 16:30 > > To: dba-vb at databaseadvisors.com > > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > > > Richard, > > > > Use the SetFocus method of the page to simulate clicking on the tab. > > Tab control pages can be named, like any other control. Here's some > > code: > > > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > > > A page can be identifed by its name or index value. > > > > Seth > > > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > > Hi Group > > > > > > Having problems trying to code a tabstrip click i.e. code to change > the > > tab > > > - can't seem to be able to find the correct method. > > > Any ideas > > > > > > Thanks > > > Richard > > > > > > > -- > > Seth Galitzer sgsax at ksu.edu > > Computing Specialist http://puma.agron.ksu.edu/~sgsax > > Dept. of Plant Pathology > > Kansas State University > > > > _______________________________________________ > > dba-VB mailing list > > dba-VB at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-vb > > http://www.databaseadvisors.com > > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > > --------------------------------------------------------- > This e-mail transmission may contain information that is proprietary, > privileged and/or confidential and is intended exclusively for the > person(s) to whom it is addressed. Any use, copying, retention or > disclosure by any person other than the intended recipient or the intended > recipient's designees is strictly prohibited. If you are not the intended > recipient or their designee, please notify the sender immediately by > return e-mail and delete all copies. > > --------------------------------------------------------- > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From bkollodge at parkindustries.com Tue Jan 27 09:27:18 2004 From: bkollodge at parkindustries.com (bkollodge at parkindustries.com) Date: Tue, 27 Jan 2004 09:27:18 -0600 Subject: [dba-VB] Cursor control Message-ID: Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering From paul.hartland at fsmail.net Tue Jan 27 09:52:19 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 27 Jan 2004 16:52:19 +0100 (CET) Subject: [dba-VB] Cursor control Message-ID: <2473302.1075218739278.JavaMail.www@wwinf3005> To Bill, Hopefully this should get you started in the right direction Public pubCursor As Integer Private Sub cmdLeft_Click() Me.Text0.SetFocus If (pubCursor > 0) Then pubCursor = pubCursor - 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub cmdRight_Click() Me.Text0.SetFocus If (pubCursor < Len(Trim(Me.Text0))) Then pubCursor = pubCursor + 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub Form_Open(Cancel As Integer) pubCursor = 0 End Sub Private Sub Text0_GotFocus() Me.Text0.SelStart = pubCursor End Sub The Text0_GotFocus moves the cursor to the last position known to pubCursor, then the cmdLeft & cmdRight buttons move the cursor to either the left or right of the last position. Paul Message date : Jan 27 2004, 03:29 PM >From : bkollodge at parkindustries.com To : dba-VB at databaseadvisors.com Copy to : Subject : [dba-VB] Cursor control Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From paul.hartland at fsmail.net Wed Jan 28 03:28:17 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 28 Jan 2004 10:28:17 +0100 (CET) Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <13710544.1075282097676.JavaMail.www@wwinf3005> To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields ? Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I?m using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From sgsax at ksu.edu Wed Jan 28 08:09:25 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Wed, 28 Jan 2004 08:09:25 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 In-Reply-To: <13710544.1075282097676.JavaMail.www@wwinf3005> References: <13710544.1075282097676.JavaMail.www@wwinf3005> Message-ID: <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Paul, Have a look at the downloads on my website. I have sample code for file I/O in VB. The code was written for Access, but is generic enough it should work in VB without a problem. I use DAO in there for database access, but you can easily substitue ADO if you prefer. Seth On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > To all, > > Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. > > My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). > > The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. > > Thanks in advance for any help as, this project needs to be ready for Monday morning > > Paul Hartland > Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month > www.freeserve.com/anytime -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From martyconnelly at shaw.ca Wed Jan 28 10:39:07 2004 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 28 Jan 2004 08:39:07 -0800 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 References: <13710544.1075282097676.JavaMail.www@wwinf3005> <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Message-ID: <4017E5AB.4090000@shaw.ca> For a quick and dirty on a csv text file. With a Jet install you should have access to TEXT OLEDB Provider Then oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\somepath\;" & _ "Extended Properties=""text;HDR=Yes;FMT=Delimited""" The HDR = Yes indicates Column names are included in the file. 'Then open a recordset based on a select on the actual file oRs.Open "Select * From MyTextFile.txt", oConn, _ adOpenStatic, adLockReadOnly, adCmdText See HOWTO: Open Delimited Text Files Using the Jet Provider's Text IIsam http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q262/5/37.ASP&NoWebContent=1 and http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJetText Seth Galitzer wrote: >Paul, > >Have a look at the downloads on my website. I have sample code for file >I/O in VB. The code was written for Access, but is generic enough it >should work in VB without a problem. I use DAO in there for database >access, but you can easily substitue ADO if you prefer. > >Seth > >On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > > >>To all, >> >>Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. >> >>My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). >> >>The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. >> >>Thanks in advance for any help as, this project needs to be ready for Monday morning >> >>Paul Hartland >>Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month >>www.freeserve.com/anytime >> >> > > > -- Marty Connelly Victoria, B.C. Canada From JRojas at tnco-inc.com Wed Jan 28 12:21:03 2004 From: JRojas at tnco-inc.com (Joe Rojas) Date: Wed, 28 Jan 2004 13:21:03 -0500 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <806536912C472E4A9D6515DF2E57261E2396A6@mercury.tnco-inc.com> Do you HAVE to use VB to do this? Can you just use Access and do a File -> Get External Data -> Import? This would be much easier, IMO. JR -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 4:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com This electronic transmission is strictly confidential to TNCO, Inc. and intended solely for the addressee. It may contain information which is covered by legal, professional, or other privileges. If you are not the intended addressee, or someone authorized by the intended addressee to receive transmissions on behalf of the addressee, you must not retain, disclose in any form, copy, or take any action in reliance on this transmission. If you have received this transmission in error, please notify the sender as soon as possible and destroy this message. While TNCO, Inc. uses virus protection, the recipient should check this email and any attachments for the presence of viruses. TNCO, Inc. accepts no liability for any damage caused by any virus transmitted by this email. From DWUTKA at marlow.com Wed Jan 28 13:37:30 2004 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 28 Jan 2004 13:37:30 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <2F8793082E00D4119A1700B0D0216BF8022277D9@main2.marlow.com> Assuming you're text file looks like this: 12354324532,$3.15 53243242341,$4.25 (where there is a carriage return line feed between each record) you could do this: Dim f as Long Dim strTemp as string dim RecordArray() as String dim FieldArray() as String dim rs As ADODB.Recordset dim cnn as ADODB.Connection dim strSQL as String dim i As Long f=FreeFile Open "C:\PathToFile\FileName.txt" for Binary Access Read As f strTemp=space(lof(f)) get f,,strTemp close f RecordArray=Split(strTemp, vbcrlf) Set cnn=new adodb.connection 'Connect to your mdb Set rs=new ADODB.Recordset strSQL="SELECT Barcode, Price FROM tblTableName" rs.open strsql,cnn,adopenkeyset, adLockOptimistic For i=0 to Ubound(RecordArray) FieldArray=Split(RecordArray(i),",") rs.AddNew rs.fields(0).value=fieldArray(0) rs.fields(1).value=FieldArray(1) rs.Update next i rs.close set rs=nothing cnn.close set cnn=nothing -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 3:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From askolits at ot.com Thu Jan 1 22:00:00 2004 From: askolits at ot.com (John Skolits) Date: Thu, 1 Jan 2004 23:00:00 -0500 Subject: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 In-Reply-To: <5B898D9F0627974EB82D0645E52B1E7D035CB9AD@EXMBPR03.na.mmfg.net> Message-ID: Here's a DAO procedure, but I think Lorraine's ADO method is better. John --------------- Function SqlServerSP_Test() 'This will essentially create a pass-thru query Dim strODBCConnection As String 'Store the ODBC connect string into a variable strODBCConnection = "ODBC;DRIVER={SQL Server};SERVER=DatabaseSERVERName;UID=SA;PWD=MyPassword;DATABASE=SQL_DATABAS EName" 'Create a query def object Dim MyQry As DAO.QueryDef Set MyQry = CurrentDb().CreateQueryDef("") 'no need to give it a name since it's just a temporary object 'If you do give it a name, it will be saved in your database window as a pass-thru query. 'Set the connection string MyQry.Connect = strODBCConnection 'Timeout is typically 60 seconds. If you think it may take a while to run, 'increase it accordingly. Otherwise, an error may occur MyQry.ODBCTimeout = 120 MyQry.ReturnsRecords = False 'If not returning records, set to false 'Set the sql statement of the query def to be the stored procedure. 'Include the EXECUTE command MyQry.SQL = "EXECUTE SP_MyStoredProcedure" 'You can also pass an argument. Make sure these is a space after the SP before adding the argument MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "45" 'Passing a numeric value MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "'Hello'" 'Passing a string 'Now execute the query MyQry.Execute 'Use this when not returning records 'Close your query def object MyQry.Close End Function ---------------------- -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Christian, Lorraine Sent: Wednesday, December 31, 2003 1:16 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 Hi there! Not be near my source code. Would something like this help? Public Sub AutoNumber() Dim cmd As New ADODB.Command cmd.ActiveConnection = myConn2 cmd.CommandType = adCmdStoredProc cmd.CommandText = "NBPHI.NEXT_INTVW_ID_NR" cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Execute iErrorResponse = cmd.Parameters(0).Value If cmd.Parameters(0).Value = 0 Then intKey = cmd.Parameters(1).Value Else MsgBox "An error occured creating this record. Contact your support", vbCritical End If End Sub HTHs Lorraine Happy New Year -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Francisco H Tapia Sent: Wednesday, December 31, 2003 12:35 PM To: paul.hartland at fsmail.net; dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 paul.hartland at fsmail.net wrote: >To all, > >I am currently writing a visual basic application with which the back-end will be on SQL Server 7.0. I currently have a data environment with a command object that links to a stored procedure on the SQL Server. What I want to be able to do is do away with the DataEnvironment and execute the stored procedure from a module and pass the results (i.e. if I had a SELECT SP into a recordset. > >Anyone any ideas how to do this. > >Thanks in advance. > >Paul Hartland > > Use ADO. for help on ADO check your online help, MSDN or http://www.able-consulting.com/tech.htm -- -Francisco _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From paul.hartland at fsmail.net Fri Jan 9 04:24:13 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Fri, 9 Jan 2004 11:24:13 +0100 (CET) Subject: [dba-VB] Multiple-step operation generated errors - check each status value Message-ID: <21241280.1073643853716.JavaMail.www@wwinf3002> To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From ebarro at afsweb.com Fri Jan 9 09:11:02 2004 From: ebarro at afsweb.com (Eric Barro) Date: Fri, 9 Jan 2004 07:11:02 -0800 Subject: [dba-VB] Multiple-step operation generated errors - check each status value In-Reply-To: <21241280.1073643853716.JavaMail.www@wwinf3002> Message-ID: Paul, Check the record lock type you defined for the recordset. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of paul.hartland at fsmail.net Sent: Friday, January 09, 2004 2:24 AM To: dba-vb Cc: accessd Subject: [dba-VB] Multiple-step operation generated errors - check each status value To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 From R.Griffiths at bury.gov.uk Tue Jan 20 09:30:58 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 15:30:58 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Hi Group Having problems trying to code a tabstrip click i.e. code to change the tab - can't seem to be able to find the correct method. Any ideas Thanks Richard From sgsax at ksu.edu Tue Jan 20 10:30:12 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Tue, 20 Jan 2004 10:30:12 -0600 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: References: Message-ID: <1074616212.25787.44.camel@sgsax-th4022.ksu.edu> Richard, Use the SetFocus method of the page to simulate clicking on the tab. Tab control pages can be named, like any other control. Here's some code: tabMyTabControl.Pages("pgeMyPage").SetFocus A page can be identifed by its name or index value. Seth On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > > Thanks > Richard > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From R.Griffiths at bury.gov.uk Tue Jan 20 10:43:57 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 16:43:57 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From LChristian at MassMutual.com Tue Jan 20 12:29:09 2004 From: LChristian at MassMutual.com (Christian, Lorraine) Date: Tue, 20 Jan 2004 13:29:09 -0500 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <5B898D9F0627974EB82D0645E52B1E7D035CBB40@EXMBPR03.na.mmfg.net> Hi there How about: Private Sub Form_Load() ' Sets focus to the first tab on the Main tab control and ' sets focus to the second tab on the Initial tab control SSTabMain.Tab = 0 SSTabInitial.Tab = 1 End Sub OR Private Sub SSTabInitial_Click(PreviousTab As Integer) Select Case PreviousTab Case 0 ' Personal Data Do something Case 1 ' Citizenship/Insurance Status Do something End Select End Sub HTH, Lorraine -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, Richard Sent: Tuesday, January 20, 2004 11:44 AM To: 'dba-vb at databaseadvisors.com' Subject: RE: [dba-VB] Tabstrip Control - VB6 Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- From stuart at lexacorp.com.pg Tue Jan 20 16:58:22 2004 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Wed, 21 Jan 2004 08:58:22 +1000 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: Message-ID: <400E3F2E.20767.21AF79@localhost> On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From paul.hartland at fsmail.net Wed Jan 21 03:14:29 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 21 Jan 2004 10:14:29 +0100 (CET) Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <2873815.1074676469264.JavaMail.www@wwinf3006> Stuart, I used to use the tabstrip control with frames to hold the controls, so when you click a tab you hide one frame and show another etc. But we recently purchased Infragistics NetAdvantage Suite (mainly for it's datagrid (UltraGrid) control), and it has lots of other very good controls one being a tab form along with a tabpanel. You place the tabform on your screen and then for each tab you add a tab panel, and infragistics does the rest. Hope that helps............ Paul Hartland Message date : Jan 20 2004, 11:16 PM >From : "Stuart McLachlan" To : dba-vb at databaseadvisors.com Copy to : Subject : Re: [dba-VB] Tabstrip Control - VB6 On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From R.Griffiths at bury.gov.uk Thu Jan 22 02:58:33 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Thu, 22 Jan 2004 08:58:33 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Lorraine you set me on the right path to get it working, which is .... TabStrip.tabs(Tabindex).selected = x (note there are at least 2 MS tab controls (SSTab and TabStrip) which is why some of th offered solutions did not work ) Thanks for all contributions Richard > -----Original Message----- > From: Christian, Lorraine [SMTP:LChristian at MassMutual.com] > Sent: 20 January 2004 18:29 > To: dba-vb at databaseadvisors.com > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > Hi there > > How about: > > Private Sub Form_Load() > > ' Sets focus to the first tab on the Main tab control and > ' sets focus to the second tab on the Initial tab control > > SSTabMain.Tab = 0 > SSTabInitial.Tab = 1 > > End Sub > > OR > > Private Sub SSTabInitial_Click(PreviousTab As Integer) > > > Select Case PreviousTab > > Case 0 ' Personal Data > Do something > > Case 1 ' Citizenship/Insurance Status > Do something > > End Select > > End Sub > > > HTH, > Lorraine > -----Original Message----- > From: dba-vb-bounces at databaseadvisors.com > [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, > Richard > Sent: Tuesday, January 20, 2004 11:44 AM > To: 'dba-vb at databaseadvisors.com' > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > > Seth > > the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have > this > propery/method .Pages > > Richard > > > > > -----Original Message----- > > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > > Sent: 20 January 2004 16:30 > > To: dba-vb at databaseadvisors.com > > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > > > Richard, > > > > Use the SetFocus method of the page to simulate clicking on the tab. > > Tab control pages can be named, like any other control. Here's some > > code: > > > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > > > A page can be identifed by its name or index value. > > > > Seth > > > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > > Hi Group > > > > > > Having problems trying to code a tabstrip click i.e. code to change > the > > tab > > > - can't seem to be able to find the correct method. > > > Any ideas > > > > > > Thanks > > > Richard > > > > > > > -- > > Seth Galitzer sgsax at ksu.edu > > Computing Specialist http://puma.agron.ksu.edu/~sgsax > > Dept. of Plant Pathology > > Kansas State University > > > > _______________________________________________ > > dba-VB mailing list > > dba-VB at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-vb > > http://www.databaseadvisors.com > > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > > --------------------------------------------------------- > This e-mail transmission may contain information that is proprietary, > privileged and/or confidential and is intended exclusively for the > person(s) to whom it is addressed. Any use, copying, retention or > disclosure by any person other than the intended recipient or the intended > recipient's designees is strictly prohibited. If you are not the intended > recipient or their designee, please notify the sender immediately by > return e-mail and delete all copies. > > --------------------------------------------------------- > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From bkollodge at parkindustries.com Tue Jan 27 09:27:18 2004 From: bkollodge at parkindustries.com (bkollodge at parkindustries.com) Date: Tue, 27 Jan 2004 09:27:18 -0600 Subject: [dba-VB] Cursor control Message-ID: Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering From paul.hartland at fsmail.net Tue Jan 27 09:52:19 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 27 Jan 2004 16:52:19 +0100 (CET) Subject: [dba-VB] Cursor control Message-ID: <2473302.1075218739278.JavaMail.www@wwinf3005> To Bill, Hopefully this should get you started in the right direction Public pubCursor As Integer Private Sub cmdLeft_Click() Me.Text0.SetFocus If (pubCursor > 0) Then pubCursor = pubCursor - 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub cmdRight_Click() Me.Text0.SetFocus If (pubCursor < Len(Trim(Me.Text0))) Then pubCursor = pubCursor + 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub Form_Open(Cancel As Integer) pubCursor = 0 End Sub Private Sub Text0_GotFocus() Me.Text0.SelStart = pubCursor End Sub The Text0_GotFocus moves the cursor to the last position known to pubCursor, then the cmdLeft & cmdRight buttons move the cursor to either the left or right of the last position. Paul Message date : Jan 27 2004, 03:29 PM >From : bkollodge at parkindustries.com To : dba-VB at databaseadvisors.com Copy to : Subject : [dba-VB] Cursor control Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From paul.hartland at fsmail.net Wed Jan 28 03:28:17 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 28 Jan 2004 10:28:17 +0100 (CET) Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <13710544.1075282097676.JavaMail.www@wwinf3005> To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields ? Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I?m using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From sgsax at ksu.edu Wed Jan 28 08:09:25 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Wed, 28 Jan 2004 08:09:25 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 In-Reply-To: <13710544.1075282097676.JavaMail.www@wwinf3005> References: <13710544.1075282097676.JavaMail.www@wwinf3005> Message-ID: <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Paul, Have a look at the downloads on my website. I have sample code for file I/O in VB. The code was written for Access, but is generic enough it should work in VB without a problem. I use DAO in there for database access, but you can easily substitue ADO if you prefer. Seth On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > To all, > > Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. > > My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). > > The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. > > Thanks in advance for any help as, this project needs to be ready for Monday morning > > Paul Hartland > Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month > www.freeserve.com/anytime -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From martyconnelly at shaw.ca Wed Jan 28 10:39:07 2004 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 28 Jan 2004 08:39:07 -0800 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 References: <13710544.1075282097676.JavaMail.www@wwinf3005> <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Message-ID: <4017E5AB.4090000@shaw.ca> For a quick and dirty on a csv text file. With a Jet install you should have access to TEXT OLEDB Provider Then oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\somepath\;" & _ "Extended Properties=""text;HDR=Yes;FMT=Delimited""" The HDR = Yes indicates Column names are included in the file. 'Then open a recordset based on a select on the actual file oRs.Open "Select * From MyTextFile.txt", oConn, _ adOpenStatic, adLockReadOnly, adCmdText See HOWTO: Open Delimited Text Files Using the Jet Provider's Text IIsam http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q262/5/37.ASP&NoWebContent=1 and http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJetText Seth Galitzer wrote: >Paul, > >Have a look at the downloads on my website. I have sample code for file >I/O in VB. The code was written for Access, but is generic enough it >should work in VB without a problem. I use DAO in there for database >access, but you can easily substitue ADO if you prefer. > >Seth > >On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > > >>To all, >> >>Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. >> >>My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). >> >>The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. >> >>Thanks in advance for any help as, this project needs to be ready for Monday morning >> >>Paul Hartland >>Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month >>www.freeserve.com/anytime >> >> > > > -- Marty Connelly Victoria, B.C. Canada From JRojas at tnco-inc.com Wed Jan 28 12:21:03 2004 From: JRojas at tnco-inc.com (Joe Rojas) Date: Wed, 28 Jan 2004 13:21:03 -0500 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <806536912C472E4A9D6515DF2E57261E2396A6@mercury.tnco-inc.com> Do you HAVE to use VB to do this? Can you just use Access and do a File -> Get External Data -> Import? This would be much easier, IMO. JR -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 4:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com This electronic transmission is strictly confidential to TNCO, Inc. and intended solely for the addressee. It may contain information which is covered by legal, professional, or other privileges. If you are not the intended addressee, or someone authorized by the intended addressee to receive transmissions on behalf of the addressee, you must not retain, disclose in any form, copy, or take any action in reliance on this transmission. If you have received this transmission in error, please notify the sender as soon as possible and destroy this message. While TNCO, Inc. uses virus protection, the recipient should check this email and any attachments for the presence of viruses. TNCO, Inc. accepts no liability for any damage caused by any virus transmitted by this email. From DWUTKA at marlow.com Wed Jan 28 13:37:30 2004 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 28 Jan 2004 13:37:30 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <2F8793082E00D4119A1700B0D0216BF8022277D9@main2.marlow.com> Assuming you're text file looks like this: 12354324532,$3.15 53243242341,$4.25 (where there is a carriage return line feed between each record) you could do this: Dim f as Long Dim strTemp as string dim RecordArray() as String dim FieldArray() as String dim rs As ADODB.Recordset dim cnn as ADODB.Connection dim strSQL as String dim i As Long f=FreeFile Open "C:\PathToFile\FileName.txt" for Binary Access Read As f strTemp=space(lof(f)) get f,,strTemp close f RecordArray=Split(strTemp, vbcrlf) Set cnn=new adodb.connection 'Connect to your mdb Set rs=new ADODB.Recordset strSQL="SELECT Barcode, Price FROM tblTableName" rs.open strsql,cnn,adopenkeyset, adLockOptimistic For i=0 to Ubound(RecordArray) FieldArray=Split(RecordArray(i),",") rs.AddNew rs.fields(0).value=fieldArray(0) rs.fields(1).value=FieldArray(1) rs.Update next i rs.close set rs=nothing cnn.close set cnn=nothing -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 3:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From askolits at ot.com Thu Jan 1 22:00:00 2004 From: askolits at ot.com (John Skolits) Date: Thu, 1 Jan 2004 23:00:00 -0500 Subject: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 In-Reply-To: <5B898D9F0627974EB82D0645E52B1E7D035CB9AD@EXMBPR03.na.mmfg.net> Message-ID: Here's a DAO procedure, but I think Lorraine's ADO method is better. John --------------- Function SqlServerSP_Test() 'This will essentially create a pass-thru query Dim strODBCConnection As String 'Store the ODBC connect string into a variable strODBCConnection = "ODBC;DRIVER={SQL Server};SERVER=DatabaseSERVERName;UID=SA;PWD=MyPassword;DATABASE=SQL_DATABAS EName" 'Create a query def object Dim MyQry As DAO.QueryDef Set MyQry = CurrentDb().CreateQueryDef("") 'no need to give it a name since it's just a temporary object 'If you do give it a name, it will be saved in your database window as a pass-thru query. 'Set the connection string MyQry.Connect = strODBCConnection 'Timeout is typically 60 seconds. If you think it may take a while to run, 'increase it accordingly. Otherwise, an error may occur MyQry.ODBCTimeout = 120 MyQry.ReturnsRecords = False 'If not returning records, set to false 'Set the sql statement of the query def to be the stored procedure. 'Include the EXECUTE command MyQry.SQL = "EXECUTE SP_MyStoredProcedure" 'You can also pass an argument. Make sure these is a space after the SP before adding the argument MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "45" 'Passing a numeric value MyQry.SQL = "Execute SP_MyStoredProcedure" & " " & "'Hello'" 'Passing a string 'Now execute the query MyQry.Execute 'Use this when not returning records 'Close your query def object MyQry.Close End Function ---------------------- -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Christian, Lorraine Sent: Wednesday, December 31, 2003 1:16 PM To: dba-vb at databaseadvisors.com Subject: RE: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 Hi there! Not be near my source code. Would something like this help? Public Sub AutoNumber() Dim cmd As New ADODB.Command cmd.ActiveConnection = myConn2 cmd.CommandType = adCmdStoredProc cmd.CommandText = "NBPHI.NEXT_INTVW_ID_NR" cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Parameters.Append cmd.CreateParameter(, adInteger, adParamOutput) cmd.Execute iErrorResponse = cmd.Parameters(0).Value If cmd.Parameters(0).Value = 0 Then intKey = cmd.Parameters(1).Value Else MsgBox "An error occured creating this record. Contact your support", vbCritical End If End Sub HTHs Lorraine Happy New Year -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Francisco H Tapia Sent: Wednesday, December 31, 2003 12:35 PM To: paul.hartland at fsmail.net; dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Calling SQL Stored Procedure From Visual Basic 6 paul.hartland at fsmail.net wrote: >To all, > >I am currently writing a visual basic application with which the back-end will be on SQL Server 7.0. I currently have a data environment with a command object that links to a stored procedure on the SQL Server. What I want to be able to do is do away with the DataEnvironment and execute the stored procedure from a module and pass the results (i.e. if I had a SELECT SP into a recordset. > >Anyone any ideas how to do this. > >Thanks in advance. > >Paul Hartland > > Use ADO. for help on ADO check your online help, MSDN or http://www.able-consulting.com/tech.htm -- -Francisco _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com From paul.hartland at fsmail.net Fri Jan 9 04:24:13 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Fri, 9 Jan 2004 11:24:13 +0100 (CET) Subject: [dba-VB] Multiple-step operation generated errors - check each status value Message-ID: <21241280.1073643853716.JavaMail.www@wwinf3002> To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From ebarro at afsweb.com Fri Jan 9 09:11:02 2004 From: ebarro at afsweb.com (Eric Barro) Date: Fri, 9 Jan 2004 07:11:02 -0800 Subject: [dba-VB] Multiple-step operation generated errors - check each status value In-Reply-To: <21241280.1073643853716.JavaMail.www@wwinf3002> Message-ID: Paul, Check the record lock type you defined for the recordset. --- Eric Barro Senior Systems Analyst Advanced Field Services (208) 772-7060 http://www.afsweb.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of paul.hartland at fsmail.net Sent: Friday, January 09, 2004 2:24 AM To: dba-vb Cc: accessd Subject: [dba-VB] Multiple-step operation generated errors - check each status value To all, I have a Visual Basic 6 FE which is connecting to a SQL Server 7.0 BE. One of my fields is called EthnicOrigin which is a TinyInt data type, which also allows Null. The control on the form is a DataCombo, with the list field being Ethnicity and the BoundColumn being EthnicityID. When a user selects an Ethnicity all is well no problem with updating etc as the EthnicityID is entered into the Field and the DataCombo display the Ethnicity. If the user deletes the entry from EthnicOrigin then when the record tries to update I get the error Multiple-step operation generated errors - check each status value Below is the code for updating: With rsPersonnel If (frmOrrPersonnel.PVEthnic <> "") Then .Fields("EthnicOrigin") = frmOrrPersonnel.PVEthnic.BoundText Else .Fields("EthnicOrigin") = 0 End If .Update End With Can anyone tell me what I am doing wrong ? Thanks in advance for any help as this is really starting to frustrate me. Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.555 / Virus Database: 347 - Release Date: 12/23/2003 From R.Griffiths at bury.gov.uk Tue Jan 20 09:30:58 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 15:30:58 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Hi Group Having problems trying to code a tabstrip click i.e. code to change the tab - can't seem to be able to find the correct method. Any ideas Thanks Richard From sgsax at ksu.edu Tue Jan 20 10:30:12 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Tue, 20 Jan 2004 10:30:12 -0600 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: References: Message-ID: <1074616212.25787.44.camel@sgsax-th4022.ksu.edu> Richard, Use the SetFocus method of the page to simulate clicking on the tab. Tab control pages can be named, like any other control. Here's some code: tabMyTabControl.Pages("pgeMyPage").SetFocus A page can be identifed by its name or index value. Seth On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > > Thanks > Richard > -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From R.Griffiths at bury.gov.uk Tue Jan 20 10:43:57 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Tue, 20 Jan 2004 16:43:57 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From LChristian at MassMutual.com Tue Jan 20 12:29:09 2004 From: LChristian at MassMutual.com (Christian, Lorraine) Date: Tue, 20 Jan 2004 13:29:09 -0500 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <5B898D9F0627974EB82D0645E52B1E7D035CBB40@EXMBPR03.na.mmfg.net> Hi there How about: Private Sub Form_Load() ' Sets focus to the first tab on the Main tab control and ' sets focus to the second tab on the Initial tab control SSTabMain.Tab = 0 SSTabInitial.Tab = 1 End Sub OR Private Sub SSTabInitial_Click(PreviousTab As Integer) Select Case PreviousTab Case 0 ' Personal Data Do something Case 1 ' Citizenship/Insurance Status Do something End Select End Sub HTH, Lorraine -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, Richard Sent: Tuesday, January 20, 2004 11:44 AM To: 'dba-vb at databaseadvisors.com' Subject: RE: [dba-VB] Tabstrip Control - VB6 Seth the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have this propery/method .Pages Richard > -----Original Message----- > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > Sent: 20 January 2004 16:30 > To: dba-vb at databaseadvisors.com > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > Richard, > > Use the SetFocus method of the page to simulate clicking on the tab. > Tab control pages can be named, like any other control. Here's some > code: > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > A page can be identifed by its name or index value. > > Seth > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > Hi Group > > > > Having problems trying to code a tabstrip click i.e. code to change the > tab > > - can't seem to be able to find the correct method. > > Any ideas > > > > Thanks > > Richard > > > > -- > Seth Galitzer sgsax at ksu.edu > Computing Specialist http://puma.agron.ksu.edu/~sgsax > Dept. of Plant Pathology > Kansas State University > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com --------------------------------------------------------- This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. --------------------------------------------------------- From stuart at lexacorp.com.pg Tue Jan 20 16:58:22 2004 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Wed, 21 Jan 2004 08:58:22 +1000 Subject: [dba-VB] Tabstrip Control - VB6 In-Reply-To: Message-ID: <400E3F2E.20767.21AF79@localhost> On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. From paul.hartland at fsmail.net Wed Jan 21 03:14:29 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 21 Jan 2004 10:14:29 +0100 (CET) Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: <2873815.1074676469264.JavaMail.www@wwinf3006> Stuart, I used to use the tabstrip control with frames to hold the controls, so when you click a tab you hide one frame and show another etc. But we recently purchased Infragistics NetAdvantage Suite (mainly for it's datagrid (UltraGrid) control), and it has lots of other very good controls one being a tab form along with a tabpanel. You place the tabform on your screen and then for each tab you add a tab panel, and infragistics does the rest. Hope that helps............ Paul Hartland Message date : Jan 20 2004, 11:16 PM >From : "Stuart McLachlan" To : dba-vb at databaseadvisors.com Copy to : Subject : Re: [dba-VB] Tabstrip Control - VB6 On 20 Jan 2004 at 15:30, Griffiths, Richard wrote: > Hi Group > > Having problems trying to code a tabstrip click i.e. code to change the tab > - can't seem to be able to find the correct method. > Any ideas > Setting the Value property changes the page displayed. -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From R.Griffiths at bury.gov.uk Thu Jan 22 02:58:33 2004 From: R.Griffiths at bury.gov.uk (Griffiths, Richard) Date: Thu, 22 Jan 2004 08:58:33 -0000 Subject: [dba-VB] Tabstrip Control - VB6 Message-ID: Lorraine you set me on the right path to get it working, which is .... TabStrip.tabs(Tabindex).selected = x (note there are at least 2 MS tab controls (SSTab and TabStrip) which is why some of th offered solutions did not work ) Thanks for all contributions Richard > -----Original Message----- > From: Christian, Lorraine [SMTP:LChristian at MassMutual.com] > Sent: 20 January 2004 18:29 > To: dba-vb at databaseadvisors.com > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > Hi there > > How about: > > Private Sub Form_Load() > > ' Sets focus to the first tab on the Main tab control and > ' sets focus to the second tab on the Initial tab control > > SSTabMain.Tab = 0 > SSTabInitial.Tab = 1 > > End Sub > > OR > > Private Sub SSTabInitial_Click(PreviousTab As Integer) > > > Select Case PreviousTab > > Case 0 ' Personal Data > Do something > > Case 1 ' Citizenship/Insurance Status > Do something > > End Select > > End Sub > > > HTH, > Lorraine > -----Original Message----- > From: dba-vb-bounces at databaseadvisors.com > [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Griffiths, > Richard > Sent: Tuesday, January 20, 2004 11:44 AM > To: 'dba-vb at databaseadvisors.com' > Subject: RE: [dba-VB] Tabstrip Control - VB6 > > > Seth > > the TabStrip that I am using (MS Tabbed Dialog tabctl32) does not have > this > propery/method .Pages > > Richard > > > > > -----Original Message----- > > From: Seth Galitzer [SMTP:sgsax at ksu.edu] > > Sent: 20 January 2004 16:30 > > To: dba-vb at databaseadvisors.com > > Subject: Re: [dba-VB] Tabstrip Control - VB6 > > > > Richard, > > > > Use the SetFocus method of the page to simulate clicking on the tab. > > Tab control pages can be named, like any other control. Here's some > > code: > > > > tabMyTabControl.Pages("pgeMyPage").SetFocus > > > > A page can be identifed by its name or index value. > > > > Seth > > > > On Tue, 2004-01-20 at 09:30, Griffiths, Richard wrote: > > > Hi Group > > > > > > Having problems trying to code a tabstrip click i.e. code to change > the > > tab > > > - can't seem to be able to find the correct method. > > > Any ideas > > > > > > Thanks > > > Richard > > > > > > > -- > > Seth Galitzer sgsax at ksu.edu > > Computing Specialist http://puma.agron.ksu.edu/~sgsax > > Dept. of Plant Pathology > > Kansas State University > > > > _______________________________________________ > > dba-VB mailing list > > dba-VB at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-vb > > http://www.databaseadvisors.com > > > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > > > > --------------------------------------------------------- > This e-mail transmission may contain information that is proprietary, > privileged and/or confidential and is intended exclusively for the > person(s) to whom it is addressed. Any use, copying, retention or > disclosure by any person other than the intended recipient or the intended > recipient's designees is strictly prohibited. If you are not the intended > recipient or their designee, please notify the sender immediately by > return e-mail and delete all copies. > > --------------------------------------------------------- > > _______________________________________________ > dba-VB mailing list > dba-VB at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-vb > http://www.databaseadvisors.com > From bkollodge at parkindustries.com Tue Jan 27 09:27:18 2004 From: bkollodge at parkindustries.com (bkollodge at parkindustries.com) Date: Tue, 27 Jan 2004 09:27:18 -0600 Subject: [dba-VB] Cursor control Message-ID: Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering From paul.hartland at fsmail.net Tue Jan 27 09:52:19 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Tue, 27 Jan 2004 16:52:19 +0100 (CET) Subject: [dba-VB] Cursor control Message-ID: <2473302.1075218739278.JavaMail.www@wwinf3005> To Bill, Hopefully this should get you started in the right direction Public pubCursor As Integer Private Sub cmdLeft_Click() Me.Text0.SetFocus If (pubCursor > 0) Then pubCursor = pubCursor - 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub cmdRight_Click() Me.Text0.SetFocus If (pubCursor < Len(Trim(Me.Text0))) Then pubCursor = pubCursor + 1 Me.Text0.SelStart = pubCursor End If End Sub Private Sub Form_Open(Cancel As Integer) pubCursor = 0 End Sub Private Sub Text0_GotFocus() Me.Text0.SelStart = pubCursor End Sub The Text0_GotFocus moves the cursor to the last position known to pubCursor, then the cmdLeft & cmdRight buttons move the cursor to either the left or right of the last position. Paul Message date : Jan 27 2004, 03:29 PM >From : bkollodge at parkindustries.com To : dba-VB at databaseadvisors.com Copy to : Subject : [dba-VB] Cursor control Hi, can anyone help with the following problem: I'm trying to control the cursor location in a textbox's caption. On the keyboard the left and right arrows do exactly what I need, but on my project, there will be no keyboard - only a touchscreen, so I want to add buttons to my form that will mimic the left and right arrows. This will allow the user to move the cursor across the displayed caption for editing. Thanks! Bill Kollodge CNC Engineering _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From paul.hartland at fsmail.net Wed Jan 28 03:28:17 2004 From: paul.hartland at fsmail.net (paul.hartland at fsmail.net) Date: Wed, 28 Jan 2004 10:28:17 +0100 (CET) Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <13710544.1075282097676.JavaMail.www@wwinf3005> To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields ? Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I?m using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime From sgsax at ksu.edu Wed Jan 28 08:09:25 2004 From: sgsax at ksu.edu (Seth Galitzer) Date: Wed, 28 Jan 2004 08:09:25 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 In-Reply-To: <13710544.1075282097676.JavaMail.www@wwinf3005> References: <13710544.1075282097676.JavaMail.www@wwinf3005> Message-ID: <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Paul, Have a look at the downloads on my website. I have sample code for file I/O in VB. The code was written for Access, but is generic enough it should work in VB without a problem. I use DAO in there for database access, but you can easily substitue ADO if you prefer. Seth On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > To all, > > Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. > > My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). > > The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. > > Thanks in advance for any help as, this project needs to be ready for Monday morning > > Paul Hartland > Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month > www.freeserve.com/anytime -- Seth Galitzer sgsax at ksu.edu Computing Specialist http://puma.agron.ksu.edu/~sgsax Dept. of Plant Pathology Kansas State University From martyconnelly at shaw.ca Wed Jan 28 10:39:07 2004 From: martyconnelly at shaw.ca (MartyConnelly) Date: Wed, 28 Jan 2004 08:39:07 -0800 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 References: <13710544.1075282097676.JavaMail.www@wwinf3005> <1075298965.14940.1.camel@sgsax-th4022.ksu.edu> Message-ID: <4017E5AB.4090000@shaw.ca> For a quick and dirty on a csv text file. With a Jet install you should have access to TEXT OLEDB Provider Then oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\somepath\;" & _ "Extended Properties=""text;HDR=Yes;FMT=Delimited""" The HDR = Yes indicates Column names are included in the file. 'Then open a recordset based on a select on the actual file oRs.Open "Select * From MyTextFile.txt", oConn, _ adOpenStatic, adLockReadOnly, adCmdText See HOWTO: Open Delimited Text Files Using the Jet Provider's Text IIsam http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q262/5/37.ASP&NoWebContent=1 and http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJetText Seth Galitzer wrote: >Paul, > >Have a look at the downloads on my website. I have sample code for file >I/O in VB. The code was written for Access, but is generic enough it >should work in VB without a problem. I use DAO in there for database >access, but you can easily substitue ADO if you prefer. > >Seth > >On Wed, 2004-01-28 at 03:28, paul.hartland at fsmail.net wrote: > > >>To all, >> >>Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. >> >>My .txt file contains roughly 365,876 records with two fields Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). >> >>The .txt file is comma delimited. Im using Access XP and Visual Basic 6.0 as the front-end. >> >>Thanks in advance for any help as, this project needs to be ready for Monday morning >> >>Paul Hartland >>Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month >>www.freeserve.com/anytime >> >> > > > -- Marty Connelly Victoria, B.C. Canada From JRojas at tnco-inc.com Wed Jan 28 12:21:03 2004 From: JRojas at tnco-inc.com (Joe Rojas) Date: Wed, 28 Jan 2004 13:21:03 -0500 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <806536912C472E4A9D6515DF2E57261E2396A6@mercury.tnco-inc.com> Do you HAVE to use VB to do this? Can you just use Access and do a File -> Get External Data -> Import? This would be much easier, IMO. JR -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 4:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com This electronic transmission is strictly confidential to TNCO, Inc. and intended solely for the addressee. It may contain information which is covered by legal, professional, or other privileges. If you are not the intended addressee, or someone authorized by the intended addressee to receive transmissions on behalf of the addressee, you must not retain, disclose in any form, copy, or take any action in reliance on this transmission. If you have received this transmission in error, please notify the sender as soon as possible and destroy this message. While TNCO, Inc. uses virus protection, the recipient should check this email and any attachments for the presence of viruses. TNCO, Inc. accepts no liability for any damage caused by any virus transmitted by this email. From DWUTKA at marlow.com Wed Jan 28 13:37:30 2004 From: DWUTKA at marlow.com (DWUTKA at marlow.com) Date: Wed, 28 Jan 2004 13:37:30 -0600 Subject: [dba-VB] Text File Into Access Using Visual Basic 6 Message-ID: <2F8793082E00D4119A1700B0D0216BF8022277D9@main2.marlow.com> Assuming you're text file looks like this: 12354324532,$3.15 53243242341,$4.25 (where there is a carriage return line feed between each record) you could do this: Dim f as Long Dim strTemp as string dim RecordArray() as String dim FieldArray() as String dim rs As ADODB.Recordset dim cnn as ADODB.Connection dim strSQL as String dim i As Long f=FreeFile Open "C:\PathToFile\FileName.txt" for Binary Access Read As f strTemp=space(lof(f)) get f,,strTemp close f RecordArray=Split(strTemp, vbcrlf) Set cnn=new adodb.connection 'Connect to your mdb Set rs=new ADODB.Recordset strSQL="SELECT Barcode, Price FROM tblTableName" rs.open strsql,cnn,adopenkeyset, adLockOptimistic For i=0 to Ubound(RecordArray) FieldArray=Split(RecordArray(i),",") rs.AddNew rs.fields(0).value=fieldArray(0) rs.fields(1).value=FieldArray(1) rs.Update next i rs.close set rs=nothing cnn.close set cnn=nothing -----Original Message----- From: paul.hartland at fsmail.net [mailto:paul.hartland at fsmail.net] Sent: Wednesday, January 28, 2004 3:28 AM To: dba-vb Cc: accessd Subject: [dba-VB] Text File Into Access Using Visual Basic 6 To all, Can anyone tell me (preferably with sample code, if possible), what is the fastest way to import a .txt file into a predefined table in access via Visual Basic 6. My .txt file contains roughly 365,876 records with two fields - Barcode, Price. This has to be imported into an Access table also containing two fields Barcode (text), Price (Number, Double, Fixed, 2 decimal places). The .txt file is comma delimited. I'm using Access XP and Visual Basic 6.0 as the front-end. Thanks in advance for any help as, this project needs to be ready for Monday morning...... Paul Hartland Freeserve AnyTime - HALF PRICE for the first 3 months - Save ?7.50 a month www.freeserve.com/anytime _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com