English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am needed to create a database in access then link it with visual basic, i have done that everething works i can scroll through the records all fine. But i have the following problems.

1. When i add custom buttons, such as "Next" "Back", say if its the first record and i go backwards, i get an error then i am asked to debug, how can i fix this?
2. If i have no records in access i cant seem to add any new records from visual basic to access, like i run the program, if there are 0 records in the database i click my add new button but whenever i enter something inside the text box then select the 2nd one the data disaprears.
3. How can i make the ADO link invizible? so you cannot see it when you run the program?

thanks for any help!

2007-03-02 04:23:18 · 6 answers · asked by Anonymous in Computers & Internet Programming & Design

6 answers

For #2, There's a glitch in VB 6 that it sometimes doesn't like an empty database. When I've had issues with this in the past, I just put a dummy record in. If you don't want junk data, then put an if statement in to check for the dummy record and replace it with the first good record.

IF Column1 = "Dummy Record" then
Update MYtable
SET Column1 = "New Good Rcord"
End if

As long as you put somethng in the dummy record that can't ever possibly be a valid record, this will work fine.

2007-03-02 06:11:12 · answer #1 · answered by rod 6 · 0 0

Are you using the visual basic that is part of Access, or are you talking VB the external program that you can purchase separate from Access?

Either way for #1 an if statement to test if the record is the first one should be possible, if it is the first record simply do nothing, else perform logic to go to previous record.

The other 2 questions I'm afraid it's been too long since I touched access or visual basic to try and help you :(.

2007-03-02 12:34:36 · answer #2 · answered by Justaguyinaplace 4 · 0 0

Check out the book "Learn to Program With Visual BASIC Databases" (ISBN 1-9296-8517-3) by John Smiley. One in a series on VB 6, this book deals with that exact issue.
I have linked to this book's Barnes and Noble page in the sources section.

2007-03-02 13:29:59 · answer #3 · answered by Richard H 7 · 0 0

I think that you just use the property inspector for 3 but its been awhile. Unless this is a school project I suggest learning something else. I have a friend who used VB still but other languages are easier for database manipulation. Sorry that I couldn't be of more help.

2007-03-02 12:31:48 · answer #4 · answered by windfishfighter 3 · 0 0

Do you mean the ADO Control?

You can go to the properties of it, make the visible false, so that if you will run your program, no one can see it...

or you can simple code it

Private Sub Form_Load()
ADOName.visible = False
End Sub

2007-03-02 15:00:45 · answer #5 · answered by web2sign 2 · 0 0

if index > (1 or zero) regardin your index
step backwards

2007-03-02 12:47:33 · answer #6 · answered by Rami 5 · 0 0

fedest.com, questions and answers