|
You have not sid if you want it on a form in Access or to bring it up in another window.
I am not sure if you can do this in VBA, but in VB6 to load the spreadsheet into a form you place it in an OLE Container.
To bring Excel up in a seperate window you could try using the excel object by setting a reference in access to the excel.olb
David Loring
!! Keep Music Live !!
|
|
|
|
|
Is there a way to reference microsoft access programatically?
|
|
|
|
|
|
You could add a reference to the MS Access library and declare the MS Access application as an object variable in your code.
|
|
|
|
|
What is it that you want to do? Can't you do it using a database connection?
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
I'm trying to transfer text files into Microsoft Access for data importing/exporting. Also copy table objects if they do not exist and run simple sql statements against Access tables. Here is the code...
Function ImportTXTFileIntoAccess(ByVal MyImpTableName$, ByVal MyTxtFileFolderPath$, ByVal MyTxtFileName$, ByVal MySpecialCase$, ByVal ForFutureUse2$, ByVal ForFutureUse3$)
On Error GoTo MyErrorControl
' FUNCTION EXPECTS:
' 1) CSV or TXT file with FIELD HEADERS in first line
' 2) CSV must contains only ONE record (one patient)
' 3) CSV must be named using the following format:
' PatientMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV
' SpouseMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV and so ON
' Note: Unique identifier between tables are normally set using DATE_TIME STAMP at time of creation
Select Case UCase(MySpecialCase)
Case "CLEAR TEMP TABLES IN ACCESS", "EMPTY TABLES", "EMPTY TEMP TABLES", "CLEAR TEMP TABLES", "CLEAR TEMP TABLES ONLY", "INITIALIZE TEMPORARY TABLES", "INITIALIZE TEMPORARY TABLES ONLY"
TryToEmptyTablesAgain:
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_PatientMWPAT_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_SpouseMWPAT_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_CaseMWCAS_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_AddressMWADD_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_AddressSpouseMWADD_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_PrimaryInsuranceMWINS_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_SecondaryInsuranceMWINS_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [IMP_ResponsiblePartyMWPAT_Spec]")
AccessTmpDB.DoCmd.RunSQL("DELETE * FROM [MyStatus]")
Exit Function
Case "IMPORT TXT FILE", "IMPORT TXT FILES", "IMPORT FILES", "IMPORT", "PROCESS FILES", "PROCESS CSV"
If File.Exists(MyTxtFileName) Then
' Import one patient than update Link field so we can later match up the patient with spouse, guantor, insurance, case
Dim MyLinkID As String
' Find where the first _ (underscore pos is)
Dim myPos As Integer
myPos = InStr(MyTxtFileName, "_")
If myPos > 0 Then
MyLinkID = Mid(MyTxtFileName, (myPos + 1), 250) ' 250 max file name legth
Dim MySQL = "UPDATE " & MyImpTableName & " SET " & MyImpTableName & ".[MyLinkID] = '" & MyLinkID & "' WHERE ([MyLinkID] Is Null)"
AccessTmpDB.DoCmd.TransferText(0, MyImpTableName, MyImpTableName, MyTxtFileName, True, "")
AccessTmpDB.DoCmd.RunSQL(MySQL)
Else
MsgBox("Sorry, CSV or TXT NAME convention DOES NOT MEET REQUIREMENTS. Name format MUST BE as follows:" & Chr(13) & Chr(13) & " PatientMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV" & Chr(13) & " SpouseMWPAT_xxxWhateverUniqueIdenfierBetweenTablesxxxxxx.CSV and so ON" & Chr(13) & "UNABLE TO CONTINUE")
Exit Function
End If
Else
MsgBox("File to be imported DOES NOT exist: " & MyTxtFileName)
Exit Function
End If
Case Else
MsgBox("Sorry, option not implemented: " & MySpecialCase)
Exit Function
End Select
GoTo ExitFunction
TableDoesNotExist:
' Create table using MASTER table
AccessTmpDB.DoCmd.CopyObject(, "IMP_PatientMWPAT_Spec", Access.AcObjectType.acTable, "IMP_PatientMWPAT_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_SpouseMWPAT_Spec", Access.AcObjectType.acTable, "IMP_SpouseMWPAT_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_CaseMWCAS_Spec", Access.AcObjectType.acTable, "IMP_CaseMWCAS_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_AddressMWADD_Spec", Access.AcObjectType.acTable, "IMP_AddressMWADD_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_AddressSpouseMWADD_Spec", Access.AcObjectType.acTable, "IMP_AddressSpouseMWADD_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_PrimaryInsuranceMWINS_Spec", Access.AcObjectType.acTable, "IMP_PrimaryInsuranceMWINS_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_SecondaryInsuranceMWINS_Spec", Access.AcObjectType.acTable, "IMP_SecondaryInsuranceMWINS_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "IMP_ResponsiblePartyMWPAT_Spec", Access.AcObjectType.acTable, "IMP_ResponsiblePartyMWPAT_SpecMASTER")
AccessTmpDB.DoCmd.CopyObject(, "MyStatusMASTER", Access.AcObjectType.acTable, "MyStatusMASTER")
' Clear temp tables again
GoTo TryToEmptyTablesAgain
ExitFunction:
Exit Function
MyErrorControl:
Select Case Err.Number
Case 0
Exit Function
Case 3078
Resume TableDoesNotExist ' Create tables
Case Else
Call iDisplayErrorMessage(Err.Number, Err.Description, "ImportTXTFileIntoAccess", vbOKOnly)
Exit Function
End Select
End Function
|
|
|
|
|
I'm porting C# code to VB .NET and I'm having trouble converting the following C# structure to VB .NET? I'm having problems with ArraySubType.
public struct FrameInfo
{
...
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65536, ArraySubType = UnmanagedType.U1)]
public byte[] Frame;
}
Thanks
VF
|
|
|
|
|
Hello everybody,
I'm new to VB.NET and I'm just wondering what is the correct method to populate a combo box in order for the user to see a value (like a caption) and behind the scene to get a value.
Something like :
("caption1",val1)
("caption2",val2)
I'm asking this because I have to run from vb.net an Oracle package and pass the parameters (va1 or val2 etc) based on what the user is selecting from combo box.
I apologize in advanced if this issue was already discussed.
Thank you,
|
|
|
|
|
Even if it was discussed, if you can't see it, then it's worth discussing again )
If you have a combo box called cb, then cb.Items.Add is the way to add an item, I can't recall if you need to construct an item there, or just pass two values.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you for your answer.
I managed to solve the problem creating a new class and using the DataSource,Displaymember and Valuemember properties of the combobox control.
|
|
|
|
|
Hi!
Im working with VS2003 — VB.Net. I stuck with problem. When i apply serialization for my class, i cant get element with 2 attrib: one attribute as null (xsi:nil="true") and another - valuable.
Like this : <IndTaxNum ROWNUM="1" xsi:nil="true" />
My code:
' piece of class for serialization
Public Class DBody
' .....................
<System.Xml.Serialization.XmlElementAttribute("IndTaxNum", _
Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, _
IsNullable:=True)> _
Public IndTaxNum() As IndTaxNumColumn
'.....................
End Class
' type IndTaxNumColumn declare
Public Class IndTaxNumColumn
<System.Xml.Serialization.XmlAttributeAttribute()> _
Public ROWNUM As Integer
<System.Xml.Serialization.XmlTextAttribute()> _
Public Value As String
End Class
XML document use for saving table. Not all variables Value have meaning (some of their Nullable).
<IndTaxNum ROWNUM="1" xsi:nil="true" />
<IndTaxNum ROWNUM="2">345453<IndTaxNum/>
<IndTaxNum ROWNUM="3" xsi:nil="true" />
<IndTaxNum ROWNUM="4">767567<IndTaxNum/>
.................
However if set in code:
Value = System.DBNull.Value.ToString or
Value = Nothing or
Value = String.Empty
generating —
<IndTaxNum ROWNUM="1" />
if dont insert value to array IndTaxNumColumn -
<IndTaxNum xsi:nil="true" />
So, what i must set for that result:
<IndTaxNum ROWNUM="1" xsi:nil="true" /> ?
thank you!
|
|
|
|
|
hi dudes,
Please help me how to create a user control calendar display.
I am not able to understand the logic how to create
Thanks in advance.
-- modified at 7:26 Monday 11th December, 2006
Success is 99% failure
|
|
|
|
|
Look at some CP articles for user controls to see the approach to take.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
does anyone know how to iterate through a registry.
I have a registry key \HKEY_CURRENT_USER\Software\MyTest
and that has several folder below it:
\HKEY_CURRENT_USER\Software\MyTest\FolderA
\HKEY_CURRENT_USER\Software\MyTest\FolderB
\HKEY_CURRENT_USER\Software\MyTest\FolderC
I need some find some function in VB.Net 2005 that will produce a list or array like:
FolderA
FolderB
FolderC
I searched through CodeProject but couldnt find anything like that.
Any response gratefully appreciated.
Mark
|
|
|
|
|
Hi,
have a look at the Registry class and the RegistryKey class espcially its GetSubKeyNames function.
Robert
|
|
|
|
|
hello all,
am creating an simple application using vb6.0 and msaccess. my problem is i want to directly connected to printer by an button press event in a form.
Not going to any datareport or something. when they fill up all the fields in the form and then they press print button. but i dont know how 2 write code for printer connection? i think it is possible, but i cant do please help me. thank you....
|
|
|
|
|
|
hi all
how can I get Ascii code of characters in vb.net
AMR-CIS
|
|
|
|
|
You could google "Ascii character set" theres thousands out there or "Ascii character codes" for a full table if you liked.
By the way, What do you need this for?
Posted by The ANZAC
|
|
|
|
|
use the Asc function (see MSDN).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Create a new application and put a button on it and listbox on it.
in the buttons click event create a for loop from 0 to 255
in the loop put listbox1.items.add("Chr(loop iterator) = " & Chr(loop iterator))
that will give you the ascii chart in a listbox. The characters that are not normal characters will show up as as box. (chr(13), chr(10), ect...)
Hope this helps.
Recreating the wheel is the best way to appreciate what the previous coders have gone through to get you where you are at now.
|
|
|
|
|
I have a database driven program. On my form i need to have a checkbox. My problem is, how do i define this in my table defenition for data type. I was going to use boolean, but it turns out that you can't. So what data type do i use for a checkbox on my form.
Posted by The ANZAC
|
|
|
|
|
That depends on what kind of database you are using. What kind of database are you using?
---
b { font-weight: normal; }
|
|
|
|
|
SQL in visual studio 2005. its in mdf format.
Posted by The ANZAC
|
|
|
|
|
Use the Bit data type. In an SQL query it has the value 0 or 1, when accessed using parameters and returned in a data reader, it is represented as a boolean.
---
b { font-weight: normal; }
|
|
|
|
|