From: Mike Painter on 4 Jan 2010 17:15 mls via AccessMonster.com wrote: > Thank you Stuart. > Can I ask you one more question? > > Suppose my var1 has > 1) value "Document Name: 12-12-2009 Test Panel" and I need to read > values after colon: how can I do that. > 2) Same way I need to read values after colon in my 3rd row "User: > image4" Instr will find the colon and Mid will return the value. YourVar = "Document Name: 12-12-2009 Test Panel" Mid (YourVar,Instr(YourVar,":")+1 ) The Split function is another way. It has a lot of advantages but can't be used without a function built around it. Mid can be used in queries as it stands.
From: mls via AccessMonster.com on 5 Jan 2010 08:48 can you help me run this code? i.e how can I check the value of testvar Sub test() Dim testvar As String var1 = "Document Name: 12-12-2009 Test Panel" testvar = Mid(var1, InStr(var1, ":") + 1) End Sub Also if my field one has the value = A10,5770,test1,Undetermined, how can I put them into different fields.. well=A10 sample=5770 dectect=test1 value=Undetermined These might look silly but I am learning VBA so.. Mike Painter wrote: >> Thank you Stuart. >> Can I ask you one more question? >[quoted text clipped - 4 lines] >> 2) Same way I need to read values after colon in my 3rd row "User: >> image4" > > Instr will find the colon and Mid will return the value. >YourVar = "Document Name: 12-12-2009 Test Panel" > >Mid (YourVar,Instr(YourVar,":")+1 ) > >The Split function is another way. It has a lot of advantages but can't be >used without a function built around it. > >Mid can be used in queries as it stands. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1
From: mls via AccessMonster.com on 5 Jan 2010 09:04 With advance options I could see that my csv file imported exactly the way I wanted. I saved the specifications but how can I open later to see the code. Mike Painter wrote: >> I am using the following code but one of my field which has both >> characters and numbers is not importing at all.. How do I handle this? >[quoted text clipped - 3 lines] >> "c:\csv_files\12-31-2009 Test.csv", False, "" >> End Sub > >Without a specification (the "") I suspect Access is guessing at what the >values are. >Probably that field starts with a number and then contains text. > >Run through a manual import first, pick the advanced button and save the >spec with a good name, then use it. > >Unless I have to pharse the file I always import into a table, then use >queries to modify what I need. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1
From: Mike Painter on 5 Jan 2010 19:34 "mls via AccessMonster.com" <u55943(a)uwe> wrote in message news:a1a87fab6feb3(a)uwe... > can you help me run this code? i.e how can I check the value of testvar > > Sub test() > Dim testvar As String > > var1 = "Document Name: 12-12-2009 Test Panel" > > testvar = Mid(var1, InStr(var1, ":") + 1) msgbox textvar or You can open an immediate window and use debug.print or > > End Sub > > Also if my field one has the value = A10,5770,test1,Undetermined, how can > I > put them into different fields.. > > well=A10 > sample=5770 > dectect=test1 > value=Undetermined > > These might look silly but I am learning VBA so.. You can use Mid for all of these but I would use Split Dim WellInfo() as string WellInfo = Split(YourWellField, ",") at this point wellInfo(0)= "A10" WellInfo(1)="5770" WellInfo(2)="test1" WellInfo(3)="Undetermined" so With SomeTable .well = wellInfo(0) .sample =WellInfo(1) .detect = wellinfo(2) .YourValue = WellInfo(3) end with > Mike Painter wrote: >>> Thank you Stuart. >>> Can I ask you one more question? >>[quoted text clipped - 4 lines] >>> 2) Same way I need to read values after colon in my 3rd row "User: >>> image4" >> >> Instr will find the colon and Mid will return the value. >>YourVar = "Document Name: 12-12-2009 Test Panel" >> >>Mid (YourVar,Instr(YourVar,":")+1 ) >> >>The Split function is another way. It has a lot of advantages but can't be >>used without a function built around it. >> >>Mid can be used in queries as it stands. > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1 >
From: Mike Painter on 5 Jan 2010 19:35 "mls via AccessMonster.com" <u55943(a)uwe> wrote in message news:a1a8a447e169e(a)uwe... > With advance options I could see that my csv file imported exactly the way > I > wanted. > I saved the specifications but how can I open later to see the code. Open another import window, go to advanced, and select the name you saved. > > > Mike Painter wrote: >>> I am using the following code but one of my field which has both >>> characters and numbers is not importing at all.. How do I handle this? >>[quoted text clipped - 3 lines] >>> "c:\csv_files\12-31-2009 Test.csv", False, "" >>> End Sub >> >>Without a specification (the "") I suspect Access is guessing at what the >>values are. >>Probably that field starts with a number and then contains text. >> >>Run through a manual import first, pick the advanced button and save the >>spec with a good name, then use it. >> >>Unless I have to pharse the file I always import into a table, then use >>queries to modify what I need. > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/201001/1 >
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Referencing subform from another form Next: Toggle Allow Additions |