Wrox Programmer Forums
|
BOOK: Beginning VB.NET Databases
This is the forum to discuss the Wrox book Beginning VB.NET Databases by Thearon Willis; ISBN: 9780764568008
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 22nd, 2006, 12:36 PM
Authorized User
 
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default MS Access ComboBox GUID Error

I'm modifying the Access version of the Time Tracker app. and I need some help with a ComboBox. I wrote the following code based on page 175:

'Passing the value in the ComboBox to a field
                    objData.AddParameter("@BranchID", _
                     OleDb.OleDbType.Guid, 16, cboUserGroup.SelectedItem.item("BranchID"))

Instead of passing the value in the ComboBox to the appropriate table, it generates a new GUID. How do I modify it so that the values passes to the table?

I made the modification based on the following code on page 484:

MyBase.AddParameter("@RoleID", _
SqlDbType.UniqueIdentifier, 16, _
User.Tables("User").Rows(0).Item("RoleID"))

Any help would be greatly appreciated.

Thanks,
Mark
 
Old October 23rd, 2006, 06:29 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Mark,

Does the BranchID in the combo box contain a GUID or just a string formatted as a GUID? If the value is just a string formatted as a GUID you can try this: objData.AddParameter("@BranchID", OleDb.OleDbType.Guid, 16, New Guid(cboUserGroup.SelectedItem.item("BranchID")))

Thearon
 
Old October 24th, 2006, 07:57 PM
Authorized User
 
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thearon,

The BranchID in the combo box does contain a GUID. Both the source and destination fields are "Number (Replication ID)" type.

Mark
 
Old October 28th, 2006, 09:02 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Mark,

What error are you getting when using the code I suggested?

Thearon
 
Old October 29th, 2006, 03:07 PM
Authorized User
 
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thearon,

The error message reads:

Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:

'Public Sub New(g As String)': Argument matching parameter 'g' narrows from 'System.Object' to 'String'.

'Public Sub New(b() As Byte)': Argument matching parameter 'b' narrows from 'System.Object' to '1-dimensional
array of Byte'.

Mark
 
Old November 1st, 2006, 07:26 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Mark,

Can you set a break point on the line of code in question, post the one line of code, and post the value from BranchID?

Thearon
 
Old November 1st, 2006, 11:31 PM
Authorized User
 
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thearon

The value of "BranchID" in a Watch window reads:
Name 'BranchID' is not declared.

Mark
 
Old November 6th, 2006, 07:16 AM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Mark,

In the Watch window you need to add a watch for cboUserGroup.SelectedItem.item("BranchID"). Do that and tell me what the value reads.

Thearon
 
Old November 6th, 2006, 05:43 PM
Authorized User
 
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thearon

The value reads "empty".

Mark
 
Old November 6th, 2006, 06:03 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Mark,

That's a problem. It sounds like your query is not pulling back data for BranchID. Is that column selected in your query?

Thearon





Similar Threads
Thread Thread Starter Forum Replies Last Post
Malformed GUID Error runtime 3075 awesomejohn Access VBA 2 October 1st, 2007 08:27 AM
Guid Error in listview click event Jimson BOOK: Beginning VB.NET Databases 9 February 16th, 2006 01:57 PM
MS Access Unknown Error mrahman Beginning VB 6 2 February 9th, 2006 03:31 AM
MS ACCESS Error 3343 Manuelaucho VB Databases Basics 0 November 14th, 2005 01:12 PM
MS Access and VBA Error Diahann Access VBA 10 January 7th, 2005 05:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.