can anybody tell me why this function is not working . i have written
a this function in module and i have called in a stock1 form but it is
not working there.can you tell me why bold line is not working.
assign.zip

here is the code written in a module :

Function GetconnectionString() As String ' The result needs to be a string !!!
Dim con As ADODB.Connection
Set con = New ADODB.Connection
con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\asfserver\itp$\Product_tabletest.mdb")
GetconnectionString = "providwer=Microsoft.jet.OLEDB.4.0;"
End Function

here is the code written in form_load()

Private Sub Form_Load()
Combo1.AddItem "Production Consumable"
Combo1.AddItem "Maintenance Consumable"
Combo1.AddItem "Tools Consumable"
Set con = New ADODB.Connection
'con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=\asfserver\itp$\Product_tabletest.mdb")
'Label10.Caption = Date
<strong>con.ConnectionString = GetconnectionString()</strong>
Label10.Caption = Format$(Now, "dddd, d mmmm yyyy")
Text1.CausesValidation = True
End Sub

Member Avatar for abbajee

Your code is working allright here on ,y machine i think you need to re-enter your database location caz i only got error of the database location when i edit the database location code it connects hope this will help you alot
Best of luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.