Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 3rd, 2004, 02:05 AM
tukiez tukiez is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 5 tukiez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
stLinkCriteria ???

Hey all

I'm a beginner in using MS Access, hope can learn a lot from this forum.

I have problems in implementing the stLinkCriteria to open a new form by double clicking a data in a List box.

I have 2 forms : "Show Group" and "Edit Group"

for now, the List Box in the "Show Group" form and the "Edit Group" form itself has the same source which is "Group"

The "Group" table has primary key of "GroupCode" and another parameter "GroupName"


I shows the complete data from the "GroupCode" throught the List Box in the "Show Group" form.

In the List Box properties, i make a code as following
------------------------------------------------------------------------
Private Sub GroupList_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Edit Group"
stLinkCriteria = "[GroupCode]=" & Me![GroupList]

DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub
-------------------------------------------------------------------------

In the "Edit Group" form it self, i make 2 text box to display the selected data.


Everytime i try to execute, it gives the following error

Let say i pick a row with "GroupCode" = BOT
and "GroupName" = Boring Tool
--------------------------------------------------------------------------
Run-time error '3075' :

Syntax error(missing operator) in query expression
'[GroupCode] = Boring Tool'.
---------------------------------------------------------------------------


But if i pick a row with "GroupCode" = CUT, "GroupName" = Cutter
or "GroupCode" = DRI , "GroupName" = Drill
or "GroupCode" = INS , "GroupName" = Insert
it will prompt me with a pop up box to insert a parameter value.
If i fill in the "GroupCode", it will show up the "EditGroup" form with a true result.

It seems that it reads the similiarity between the "GroupCode" and the "GroupName"

I'm really clueless about this problem and hope can learn from you guys.

And please don't be annoyed by me, because i think i'm going to be a regular visitor and post a lot of problems for couple of weeks ahead.

Thank you very much in advance



Reply With Quote
  #2  
Old February 3rd, 2004, 11:17 AM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
if the Groupcode is a textfield datatype then
place single quotes before and after value field as below

stLinkCriteria = "[GroupCode] = '" & Me![GroupList] & "'"

Reply With Quote
  #3  
Old February 3rd, 2004, 06:56 PM
tukiez tukiez is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 5 tukiez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thx it works, but only after i change the following

stLinkCriteria = "[GroupName] = '" & Me![GroupList] & "'"


Instead of using the primary key, i use the other parameter which is the "GroupName".
If i use "GroupCode" there will be no more error messages but it also shown nothing in the "Edit Group" form.

If i change to "GroupName" it works exactly like i wanted. What is the reason for this ?? Is it something to do with primary key or somewhere along the line i do something wrong ??

Thx

Reply With Quote
  #4  
Old February 3rd, 2004, 09:22 PM
tukiez tukiez is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 5 tukiez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
One more enquiry....

Now using the same structure i try to delete the record selected in the list box

--------------------------------------------------
Function Delete()
If MsgBox("Do You really want to delete the selected Group ?", vbOKCancel + vbDefaultButton2 + vbQuestion, "Confirmation") = vbOK Then
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("Group", dbOpenDynaset)
rs.Find ("[GroupName]= " & Forms![Show Group]![GroupList].Value)
rs.Delete
rs.Close
Forms![Show Group]![GroupList].Requery
End If

End Function
-------------------------------------------------------

it returns "Run Time error 13, type mismatch"
Can someone enlight me for this particular issue ?

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > stLinkCriteria ???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT