If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Recordset syntax for primary key consisting of two or more fields (VBA)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-11-10, 05:22
Krc Krc is offline
Registered User
 
Join Date: Mar 2010
Posts: 2
Recordset syntax for primary key consisting of two or more fields (VBA)

Hello,

I have a table Customers that has primary key consisting of one field CustomerID.

Im working with unbound fields on form and i have one listbox that shows 3 of 8 (5 are hidden) columns, and 5 unbound fields next to listbox (1 is invisible for user – thats CustomerID)

Listbox has afterupdate event to fill those 5 unbound fields.
All 5 unbound fields are set to be disabled by default.

When user wants to change data for selected customer he would click on command button that will fire an event to enable those fields for editing.

After user is finished changing data he clicks command button „Save“ which has on click event which uses CustomerID to find corresponding records.

Set rst = CurrentDb.OpenRecordset("select * from dbo_Customers
where dbo_Customers.CustomerID=" & CustomerID, dbOpenDynaset, [dbSeeChanges])


My question is what would be set rst syntax for a table that has primary key consisting of 2 fields ?

Thanx
Reply With Quote
  #2 (permalink)  
Old 03-11-10, 05:58
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Code:
Set rst = CurrentDb.OpenRecordset("select * from dbo_Customers 
where dbo_Customers.CustomerID=" & CustomerID & " AND myTextColumn = '" & TextValue & "'", dbOpenDynaset, [dbSeeChanges])
Reply With Quote
  #3 (permalink)  
Old 03-11-10, 06:19
Krc Krc is offline
Registered User
 
Join Date: Mar 2010
Posts: 2
Quote:
Originally Posted by pootle flump View Post
Code:
Set rst = CurrentDb.OpenRecordset("select * from dbo_Customers 
where dbo_Customers.CustomerID=" & CustomerID & " AND myTextColumn = '" & TextValue & "'", dbOpenDynaset, [dbSeeChanges])

Thank You. You're fast
Reply With Quote
Reply

Tags
recordset

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On