|
-
Nov 6th, 2000, 08:57 PM
#1
Thread Starter
New Member
I have a small problem. I'm trying to make a small prototype of a system I made in Ms access for a presentation.
Well basically I have this problem with record set in a small function
Private Sub Varenrliste_Change()
Dim Resultat As Recordset
Dim Dbs As Database
Set Dbs = OpenDatabase("c:\My documents\presentation.mdb")
Set Resultat = Dbs.OpenRecordset("SELECT * FROM Vare WHERE Vare.Varenr=Varenrliste.Text;")
Varenavntext.Text = Resultat.Fields("Varenavn")
Varebeskrivelsetext.Text = Resultat.Fields("Varebeskrivelse")
Varepristext.Text = Resultat.Fields("Varepris")
Resultat.Close
Dbs.Close
End Sub
Varenr is an integer and so is Varenrtext.text
however everytime I try to compile it says:
Run-time error 3061:
Too few parameters. Expected n.
can anybody please help me
-
Nov 6th, 2000, 10:26 PM
#2
Thread Starter
New Member
Come one u guy. All I need is someone to help me out
-
Nov 6th, 2000, 10:34 PM
#3
_______
<?>
Code:
'try adding this and change your set Resultat to the one here
Dim myString as string
myString = Text1.text
Set Dbs = OpenDatabase("c:\My documents\presentation.mdb")
'the quotes are single double & myString double singel
Set Resultat = Dbs.OpenRecordset("SELECT * FROM Vare WHERE Vare.Varenr='" & myString & "'")
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 6th, 2000, 11:07 PM
#4
Thread Starter
New Member
HeSaidJoe: That doesn't work. says that datatype aren't correct
-
Nov 7th, 2000, 06:51 AM
#5
Lively Member
If your Vare.Varenr field is an integer then try this
Set Resultat = Dbs.OpenRecordset("SELECT * FROM Vare WHERE Vare.Varenr='" & Val(Varenrliste.Text) & "'")
OR
Declare a integer variable to take the result of Val(Varenrliste.Text)
Then set your SQL statement to read
Set Resultat = Dbs.OpenRecordset("SELECT * FROM Vare WHERE Vare.Varenr= " & MyIntVariable)
Hope this helps
Adrian.
-
Nov 7th, 2000, 06:59 AM
#6
Fanatic Member
Replace
Set Resultat = Dbs.OpenRecordset("SELECT * FROM Vare WHERE Vare.Varenr=Varenrliste.Text;")
With
Set Resultat = Dbs.OpenRecordset("SELECT * FROM Vare WHERE Vare.Varenr=” & Varenrliste.Text)
Hope this helps,
Gaffer
-
Nov 7th, 2000, 09:23 AM
#7
New Member
I need ur help
Dim db As Database
Dim rs As Recordset
Private Sub Form_Load()
Set db = OpenDatabase("c:\fdb1.mdb")
Set rs = db.OpenRecordset("people")
End Sub
but when i run this it give me the message that unrecognised formate
pls help me
adnan
**************************
Adnan nazir
**************************
-
Nov 7th, 2000, 09:38 AM
#8
_______
<?>
Adnan nazir
Code:
'try this
'assuming you have a datacontrol called data1
Option Explicit
Public cDBName As String, cTblName As String
Public Sub OpenDB()
cDBName = "c:\fdb1.mdb"
cTblName = "people"
Data1.DatabaseName = cDBName
Data1.RecordSource = cTblName
End Sub
Private Sub Form_Load()
'
Call OpenDB
'
Set db = Workspaces(0).OpenDatabase(cDBName)
Set rs = db.OpenRecordset(cTblName)
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 7th, 2000, 09:40 AM
#9
_______
Geekabyte
try converting the string
'the quotes are single double & myString double singel
Set Resultat = Dbs.OpenRecordset("SELECT * FROM Vare WHERE Vare.Varenr='" & CInt(myString) & "'")
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 8th, 2000, 06:17 AM
#10
Lively Member
Adnan Nazir
Re your "unrecognised format" problem. Are you connecting to an Access 97 or Access 2000 DB?
If it's Access 2000 then use the Forum Search to read thru the responses on what you need to do in order to connect to Access 2000.
Cheers
Adrian
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
|