Problem With Visual Basic And Access Database

  • Thread starter Thread starter Victor Cheung
  • Start date Start date
V

Victor Cheung

I wrote a retail mangement software.. and it keeps tracks of all the sales
transaction.. and one access database keep tracks of all the sales history..
from the beginning.. there is no problem searching the access database.. and
display certain day's sales.. but after a while.. or when the access
database get bigger.. there is problem searching the access database.. the
database contain the day's sales.. but.. when the program try to seach the
database for the day's sales.. it find nothing.. anyone know why? it is
under windows xp... with DAO

method of searching

dim data....
dim recordset..


if data.eof=false or data.bof=false then
data.movefirst
end if

do while data.eof=false

if txndate="01/01/2003" then
'display sales
text1.text=data!date
text1.text=data!name
text1.text=data!total
end if

data.movenext
loop


just sample..
 
Victor,

What you haven't told us is almost more important than what
you have, especially how you are opening your recordset, any
errors that you are getting ( I think you are! ) and what
version of Access you are using.

If your Access is newer than 97 you need to add the DAO
predicator to the database and recordset lines.

dim data....
(As what? is this a test? If AS Database it should be AS
DAO.Recordset)

dim recordset..
(Same as above. If this is as Recordset, it should be AS
DAO.Recordset)

I don't see where you Set the data or recordset to anything.
Did you just not post this part or is this a missing key
component?

In your code, you are referring to "data.EOF". Should this
not be "recordset.EOF"?

I suggest that you do a copy and paste into a post back to
us so that we can see EXACTLY what you have. Then we can see
EXACTLY what is going on.

Regards,

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
s.com...
 
Dim Data1 As Database
Set Data1 = OpenDatabase("z:\comtech\rm\rmbill.mdb", dbDriverNoPrompt, True,
";DATABASE=z:\comtech\rm\rmbill.mdb;UID=Admin;PWD=verycool;")

Dim rmempl As Recordset
Set rmempl = Data1.OpenRecordset("RMEMPL", dbOpenSnapshot)



it feels like the program haven't finish reading the whole database and
execute the next command..

from what i understand Access database can handle around 2 Gig Of size.. and
around 10 cocurrent connection?

i am using Access Xp..

the file size is around 100Meg.. within the 2 Gig Limit.. Probably have to
switch to SQL soon..


data.eof means recordset.eof.. hehe.. my bad

thankz gary..
 
Well, one way to test is to find out how many records it is
returning. Try a MoveLast to go to the end of the recordset
and then a RecordCount to see how many it returns. If it
does get to the true end, you may now be able to go back to
the beginning and access all the records as they are now in
memory somewhere. I am adding some code here for testing...

Dim Data1 As Database
Set Data1 = OpenDatabase("z:\comtech\rm\rmbill.mdb",
dbDriverNoPrompt, True,
";DATABASE=z:\comtech\rm\rmbill.mdb;UID=Admin;PWD=verycool;"
)

Dim rmempl As Recordset
Set rmempl = Data1.OpenRecordset("RMEMPL", dbOpenSnapshot)

' *****
With rmempl
.MoveLast
MsgBox .RecordCount
.MoveFirst
' Now do whatever you want here if you have your records
End With



--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
rs.com...
 
I still don't understand why.. it works when there is small amount of
record.. and when it get big.. I can't read all the record into VB? Can it
be the problem with the Access Database.. can it be The Windows Xp Operating
System? Virus?

Also, when the database get bigger.. I can print a receipt out from the
program.. and the transaction is not saved into the database? I mean.. the
transaction is saved like all the other transaction.. and.. no error message
pop up.. just somehow.. it is not saved..

also.. sometime.. an runtime error 3709 pop up.. from anywhere in the
program.. when it try to access database? the error
message is "The Search Key Was Not Found In Any Record".. I don't have any
more clue.. please help..

thankz..
 
How big is your database file? You aren't nearing a size
limit are you?

What happened when you tried the MoveLast and RecordCount?

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
om...
 
I will grab the access database on sunday night.. will post it here for your
review..
 
Victor,

Just to let you know, sending attached files to the
newsgroup is kind of against the accepted rules. I may elect
to have you send it to me directly, but certainly not until
I know how big it is.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
om...
 
Back
Top