|
-
Nov 13th, 2006, 03:49 PM
#1
Thread Starter
New Member
VB Access
Hi all this is the first time here.
I'm trying get my program to search a database. I've been using a datagridview to display data from my database.
i'm also trying to get it to let me add data to an empty space. I'm desperate for help.
-
Nov 14th, 2006, 12:43 AM
#2
Re: VB Access
Hi Welcome to VBF!
is your search working fine...where do you get stuck...and what is the error if any...do you have any codings done so far...
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Nov 14th, 2006, 06:35 AM
#3
Thread Starter
New Member
Re: VB Access
I've just started with the basic form up and just need it to search a database for something and then display it on a different screen. I've got the info to display on the datagrid but that's about it.
kinda new to vb just learning rite now and my course teachers suck
-
Nov 14th, 2006, 12:26 PM
#4
Hyperactive Member
Re: VB Access
Hello,
If you're using a datagrid then you must have created an ADO Data Control (6.0) embedded in the form! Am I right.
If so to search the data on the control
VB Code:
Private Sub cmdSearch_Click()
Dim strName As String
Dim Book
Book = adodc1.Recordset.Bookmark
strName = InputBox("Please enter a Title")
adodc1.Recordset.MoveFirst
strName = "'" & strName & "'"
adodc1.Recordset.Find "Title = " & strName
If adodc1.Recordset.EOF Then
MsgBox "Title does not exist"
adodc1.Recordset.Bookmark = Book
End If
End Sub
This is a very simple search that calls an inputbox and then locates the first record that matches strName.
To add a new record
The difficulty you will have using the Data Control is that there is only a single way to refresh the data and I believe that to be out of the scope of your course.
Please also be aware that I am not going to do your coursework for you. The code above searches a data control relating to the data source given to the control at design time. Your data control will require a different a search under a different field within your control.
Steve
-
Nov 14th, 2006, 02:02 PM
#5
Thread Starter
New Member
Re: VB Access
thanks i'll work it out from here but might come and ask more questions later if i get stuck.
btw i'm not expecting anyone to do the code for me I'd rather learn wot i need but our teachers don't know how to do the database part so our class is having to get outside help but thanks. just to let u know i'd rather work for it and not be spoon feed information
when darkness falls then your computer has been turned off. 
-
Nov 15th, 2006, 10:22 AM
#6
Hyperactive Member
Re: VB Access
Hello again,
apologies for not getting back to you.
It is always a positive step to want to figure the program out for yourself as most people learn programming that way.
Also when you are stuck just post your code, using the vbcode tagging system, and you will mugged by the many here who enjoy helping broken code get fixed.
Regards
Steve
PS you will find a great amount of code available in the VB Classic FAQ .
-
Nov 16th, 2006, 03:38 PM
#7
Thread Starter
New Member
Re: VB Access
kool thanks. I've had a look and tryed it but it won't recognise the "adodc1" it keeps telling me it's not declared so i donno if it's just visual studios 2005 being dumb or if i've done something wrong.
when darkness falls then your computer has been turned off. 
-
Nov 16th, 2006, 04:02 PM
#8
Re: VB Access
For working with databases, VB 2005 (which is VB.Net) is very different to Classic VB (VB6 etc), which is what sparbag assumed you were using.
I'm afraid that like many others here, I don't use VB.Net myself, so unfortunately I can't help.
-
Nov 16th, 2006, 04:50 PM
#9
Thread Starter
New Member
Re: VB Access
rite then thanks for trying.
for all you out there help please.
when darkness falls then your computer has been turned off. 
-
Nov 16th, 2006, 07:02 PM
#10
Hyperactive Member
Re: VB Access
Hello again,
.NET at this level is certainly grabbing the dinosoar by the tail [sic].
O'Reilly
Generously donated code
HTH
Steve
-
Nov 18th, 2006, 03:59 PM
#11
Thread Starter
New Member
when darkness falls then your computer has been turned off. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|