Question about Computers & Internet

2 Answers

Vb variable error

I am connecting access database named company.mdb having fields COM_CODE, COMPANY, ADD1, ADD2, ADD3, ADD4, BOOK, PAGE

while running program all fields data but the field add2, add3, book & page showing error.

my code is below, kindly suggeste me for what is wrong in coding.

Dim strdb As Database
Dim strrs As Recordset
Private Sub EXIT_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim strdbname As String
Dim strrsname As String
strdbname = "d:\vivek\company.mdb"
strrsname = "company"
Set DB = DBEngine.OpenDatabase("D:\VIVEK\COMPANY.MDB")
Set RS = DB.OpenRecordset("COMPANY")
comp.Text = RS!COM_CODE
compnm.Text = RS!COMPANY
isinno.Text = RS!ISIN
AD1.Text = RS!ADD1
'AD2.Text = RS!ADD2
'AD3.Text = RS!ADD3
AD4.Text = RS!ADD4
BK.Text = RS!BOOK
'PG.Text = RS!Page
End Sub

Posted by on

2 Answers

  • Level 3:

    An expert who has achieved level 3 by getting 1000 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    Renaissance:

    An user who is expert in 3 categories / brands.

  • Master
  • 848 Answers

Vb variable error? This trouble maybe power supply or inverter boards is defective.
first you can test the voltage of the multr,and then check which part is defective.From Wisiny.com can find those parts
if you have any question,please let us know email:service@wisiny.com.thanks,we sincerely hope we can help you!
you can also check this boards whether suit you:
742GL2 715G2538 3 LEG Lenovo ADTV742GL2 Power Supply Backlight Inverter...

Posted on Jan 15, 2015

  • Level 3:

    An expert who has achieved level 3 by getting 1000 points

    All-Star:

    An expert that got 10 achievements.

    MVP:

    An expert that got 5 achievements.

    Brigadier General:

    An expert that has over 10,000 points.

  • Master
  • 10,406 Answers

Change the code:

strdbname = "d:\vivek\company.mdb"
Set DB = DBEngine.OpenDatabase("D:\VIVEK\COMPANY.MDB")
strrsname = "company"
Set RS = DB.OpenRecordset("COMPANY")
comp.Text = RS!COM_CODE
compnm.Text = RS!COMPANY
isinno.Text = RS!ISIN
AD1.Text = RS!ADD1
'AD2.Text = RS!ADD2
'AD3.Text = RS!ADD3
AD4.Text = RS!ADD4
BK.Text = RS!BOOK
'PG.Text = RS!Page
to become:

strdbname = "d:\vivek\company.mdb"
Set DB = DBEngine.OpenDatabase(strdbname )
strrsname = "company"
Set RS = DB.OpenRecordset(strrsname )
comp.Text = RS!COM_CODE
compnm.Text = RS!COMPANY
isinno.Text = RS!ISIN
AD1.Text = RS!ADD1
AD2.Text = RS!ADD2
AD3.Text = RS!ADD3
AD4.Text = RS!ADD4
BK.Text = RS!BOOK
PG.Text = RS!Page
mostly to eliminate the extra "quote" (') characters,
and to use the values you set.


Posted on Dec 02, 2009

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

4 Answers

Access database 2003 problem with a copy of database file. How to fix?


You say corrupt, in what way exactly? Do you get any specific error numbers/messages?

Have you tried Access repair program? Compact and Repair. If not, use it. But ensure that you made a backup, it is necessary because all the recovery tips can make the damage even worse.

Also try Jet Compact Utility. This tool created by Microsoft and it is much like Compact and Repair, but more successful in repairing.

If no one of above advice helps, then perhaps you need more powerful solution. In this case try to run a good third-party. I would recommend Recovery Toolbox for Access. It must help you. https://access.recoverytoolbox.com/

Feb 23, 2015 | Microsoft Access 2003 for PC

3 Answers

Error 3343 when I start PC Charge, how can I fix this?


error 3343 is a database error. Unfortunately, PCCharge is still in the stone-ages of computer technology and they think VB6.0 and MS Access 2.0 are stable and secure ... At any rate. 3343 is simply an unrecognizable database, in this case due to corruption. There is a program in the PCCharge directory called VisData. This will allow you to run a repair and compact the database. To use:
First make a backup of your PCCW.MDB database in your PCCharge directory (C:\Program Files\Active-Charge (PaymentServer); C:\Program
Files\PCCW (PRO)).

Execute VISDATA.exe.
File -> Repair MDB.
Select the PCCW.MDB database from your PCCharge directory.
Select 'No" to open Repaired Database.
File -> Compact MDB ... 2.0 MDB
Again, Select the PCCW.MDB
It will then prompt for what you want the database to be named. Simply select PCCW.MDB again, select 'YES' to replace existing database.
Select 'NO' to encrypt database.
Select 'NO' to Open Compacted database
Exit Visdata and start PCCharge.

It would also be a good idea to go ahead and update to the latest available Scripting Runtime library. This can be found by going to microsoft.com and searching for the phrase 'windows script'. (To my knowledge, 5.7 is the latest version).

Jul 16, 2009 | Go Software Inc. PCCharge Pro...

7 Answers

Undelete records from access table


ou can try to use third party Access recovery utility to restore your lost and damaged data from .mdb files. For more details about this software:-
Access File Recovery

Apr 17, 2009 | Microsoft Access 2000 (077-01277) for PC

1 Answer

How to connect vb with ms access


se Adodc OR Even better.. ADODB. for this you need to get MDAC fromMicrosoft free download.(check under project_References- Microsoft DataActiveX objects.. the current no is 2.8. if it is not there download invb directory.

next, you can learn about creating a DSN from control panel, ODBC. onceyou learn this, connection becomes a piece of cake. get some free vbtutoriasl from WWW.

then

you need to use DAO or ADO to connect to the database. better study both but since ADO is current, i am showing that code.
under Menu Project_References, put a check mark on Microsoft ActiveXData Objects latest version (though it works for all, currently 2.8with sp pack 1 ).

at the general declarations:
dim conn as adodb.connection, rec as adodb.recordset, esql as string,esql1 as string
Private Function connect()
Set rec = New ADODB.Recordset
Set conn = New ADODB.Connection
esql = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "D:VBDesigndhana2.mdb" & ";Persist Security Info=False"
'here you put the correct path of your mdb file. and check if you have jet 4.0

conn.Open (esql), , , 0
End Function

private sub form_Load()
connect
end sub
and for adding records:
say let us say you have 3 fields. then have 3 textboxes and 1 command button on the form.

private command1_click()
esql1="select * from Yourtablename"
rec.open(esql1),conn,, adOpenDynamic, adLockOptimistic
rec.AddNew
rec.Fields(0) = text1.Text
rec.Fields(1) = Text2.text
rec.Fields(2) = text3.text
' you need to check if in your access table design you have Allowed Zero length .. set it to Yes for all text fields.
rec.update
if not rec.eof then rec.movenext
rec.close
conn.close
set conn to nothing
end sub

this will add new records to access table from VB.
' for picture store the full path of the path and the picture file nameint the text field. and in the picturebox of VB form for viewingrecords again you need ADO or ADODC and here you code:picture1.picture=Loadpicture(rec.fields(3) ' depending on where thepicture field is located. you need to make a few trials.
under Menu Project_References, put a check mark on Microsoft ActiveXData Objects latest version (though it works for all, currently 2.8with sp pack 1 ).

at the general declarations:
dim conn as adodb.connection, rec as adodb.recordset, esql as string,esql1 as string

Private Function connect()
Set rec = New ADODB.Recordset
Set conn = New ADODB.Connection
esql = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "D:VBDesigndhana2.mdb" & ";Persist Security Info=False"
'here you put the correct path of your mdb file. and check if you have jet 4.0

conn.Open (esql), , , 0
End Function

private sub form_Load()
connect
end sub

and for accessing records:

private command1_click()
esql1="select * from Yourtablename where id =" & val(text1) ' for integers

esql1="select * from Yourtablename where name=" & "'" & text1 & "'" ' for string

rec.open(esql1),conn, adOpenstatic, adLockreadonly

label1.caption =rec.Fields(0)
label2.caption= rec.Fields(1)
label3.caption= rec.Fields(2)
' you need to check if in your access table design you have Allowed Zero length .. set it to Yes for all text fields.

rec.close
conn.close
set conn to nothing
end sub


' similarly there are routines to ADD, Delete, Edit, View etc.

Feb 26, 2009 | Computers & Internet

1 Answer

Code for find the Ms access database size using visual basic


The way to get the database size is to point to the directory that the database is do a DIR statement with an output to a file as in DIR payroll.mdb>dbsize.txt and then read from the text file, the first field of the second line being the name (which you really don't need) then the size value of the database.

To import the text files using VB 8 use

'Imports System.Data.OleDb Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\path\filename.mdb") Dim cmd As New OleDbCommand("SELECT * INTO [import] FROM [Text;Database=d:\path;Hdr=No].[dbsize.txt]", conn) conn.Open() cmd.ExecuteNonQuery() conn.Close()

Nov 10, 2008 | Microsoft Office Standard for PC

1 Answer

Create access mdb file by vfp code


Try this

#define dbLogical 1
#define dbNumber 2
#define dbInteger 3
#define dbLongInteger 4
#define dbCurrency 5
#define dbSingle 6
#define dbDouble 7
#define dbDateTime 8
#define dbBinary 9
#define dbText 10
#define dbOLEObject 11
#define dbMemo 12
#define dbReplication 15
#define dbDecimal 16
if file("C:\accesstest.mdb")
delete file c:\accesstest.mdb
endif
public oAccess
oAccess = createobject("Access.application")
oAccess.visible= .t.
newMDB = oAccess.NewCurrentDatabase("C:\accesstest")
newtable = oAccess.CurrentDb.CreateTableDef('testtable')
with newtable
.fields.append(.CreateField("Field1", dbLogical))
.fields.append(.CreateField("Field2", dbNumber))
.fields.append(.CreateField("Field3", dbInteger))
endwith
oAccess.CurrentDb.TableDefs.append( newtable)
dbc2Convert = "\\tpdfiles\data\dfreeman\tip\data\rta\rta"
open database (dbc2convert)

dbgetprop(rta,"table",)

After it runs you will need to close the MDB and reopen it.

Oct 15, 2008 | Microsoft Computers & Internet

1 Answer

About visual basic coding


Hello,
The standard way of creating a database using VBA, which can be modified to suit your needs is this--> Note: the code (wspDefault.CreateDatabase("Newdb.mdb"...), can be altered to save the database in a folder  such as "C:\NEWDB\text.mdb". sub NewDatabase()     Dim wspDefault As Workspace, dbs As Database     Dim tdf As TableDef, fld1 As Field, fld2 As Field     Dim idx As Index, fldIndex As Field     Set wspDefault = DBEngine.Workspaces(0)     ' Create new, encrypted database.     Set dbs = wspDefault.CreateDatabase("Newdb.mdb", _         dbLangGeneral, dbEncrypt)     ' Create new table with two fields.     Set tdf = dbs.CreateTableDef("Contacts")     Set fld1 = tdf.CreateField("ContactID", dbLong)     fld1.Attributes = fld1.Attributes + dbAutoIncrField     Set fld2 = tdf.CreateField("ContactName", dbText, 50)     ' Append fields.     tdf.Fields.Append fld1     tdf.Fields.Append fld2     ' Create primary key index.     Set idx = tdf.CreateIndex("PrimaryKey")     Set fldIndex = idx.CreateField("ContactID", dbLong)     ' Append index fields.     idx.Fields.Append fldIndex     ' Set Primary property.     idx.Primary = True     ' Append index.     tdf.Indexes.Append idx     ' Append TableDef object.     dbs.TableDefs.Append tdf     dbs.TableDefs.Refresh     Set dbs = Nothing End Sub
Hope this helps! Please let me know if you have any questions.Thank You,Raph30

Apr 10, 2008 | Oracle 10g Database Standard (ODBSEONUPP0)

2 Answers

Microsoft Access database


try creating (if you have not already tried) the exact folder tree as [I:\DESKTOPPC\DesktopPC\Database\Toby3]. Now put the file "Tonys_work_be.mdb" into the folder named "Toby3".

Dec 12, 2007 | Computers & Internet

3 Answers

Microsoft JET Database Engine error '80040e09'


This worked for me in a similar situation; make a copy of the .mdb file in the same folder. Delete the original .mdb file and rename the copy with the name you used for the original. This should get rid of the read-only aspect. Good luck.

Aug 29, 2007 | Microsoft Office Standard for PC

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

243 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

101516 Answers

David Payne
David Payne

Level 3 Expert

14160 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...