473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing an ID number to acGoTo (newbie)

6 New Member
Hi
I've never really worked with VBScript - I'm an old-fashioned HTML guy - but I thought I'd have a go because I wanted to do something REALLY SIMPLE in my Access 2000 database. This is a plea for help, days later, having trawled the Internet repeatedly and experimented as much as I dare looking for anything that will work.

I have a form called Communications (I now know it shoulda been frm_Communicati ons!). In it there is a combo box called Abbreviation. This refers to the Row Source: qry_Union_Abbre viations to get a list of abbreviations, along with ID number and Full name, from a Table called Communications (yep, shoulda been tbl_Communicati ons!).

The query concerned has one bound column, and the field ID is the first one, and is indexed and a primary key (in the form "Unions" which I'm wanting to call).

Anyway - the "simple task" I set myself was to put a little button beside this combo box which, when clicked on, would refer to the data in the Combo box and then open another form and go to the record whose value was that named in the Combo box.

Here's the code I have used for my On_Click Event Procedure:

Private Sub Union_more_Clic k()
intGlobalVariab le = [Union Abbreviation]
DoCmd.OpenForm "Unions"
DoCmd.GoToRecor d , , acGoTo, intGlobalVariab le
End Sub

intGlobalVariab le is defined as an Integer in a module called Module1. which also contains strGlobalVariab le, defined as a string.

On click I get error number 2498 - "an expression you entered is the wrong data type for one of the arguments".

In debugging I see the acGoTo value is "4" (seems to be always 4, no matter which record I start from) while the intGlobalVariab le is the text string in the combo box.

If I use strGlobalVariab le it makes no difference.

I have to say I've tried everything I've been able to find in forums, and the experience has got me interested in VBScript, but I know for sure ain't gonna solve this one on my own. Any suggestions you can offer will help preserve my sanity.

PS If it's any help the following code DOES open the right form, and go to the right record:

Private Sub Union_more_Clic k()
DoCmd.OpenForm "Unions"
DoCmd.GoToRecor d , , acGoTo, 7
End Sub

I think I just need to find a way to pass an ID number to acGoTo. But I'll let you be the judge of that.
May 24 '07 #1
17 17356
Peter Tenk
6 New Member
Hi
I'm trying to set up a button which will go to a string value in another form. Too simple, you say?

I have a form called Communications. In it there is a combo box called Abbreviation. This refers to the Row Source: qry_Union_Abbre viations to extract a short name, along with the ID number, from a Table.

The query has one bound column, the field ID is the first one, and it is indexed and a primary key (in the form "Unions" which I'm wanting to call).

So the simple beginner's task I set myself was to put a little button beside this combo box which, when clicked, would refer to the data in the Combo box and then open up the other form and go to the record whose value was that named in the Combo box.

Here's the code I have used for my On_Click Event Procedure:

Private Sub Union_more_Clic k()
intGlobalVariab le = [Union Abbreviation]
DoCmd.OpenForm "Unions"
DoCmd.GoToRecor d , , acGoTo, intGlobalVariab le
End Sub

On click I get error number 2498 - "an expression you entered is the wrong data type for one of the arguments".

In debugging I see the acGoTo value is "4" (seems to be always 4, no matter which record I start from) while the intGlobalVariab le is the text string in the combo box.

If I use strGlobalVariab le it makes no difference.

I've tried everything I've been able to find in forums, and the experience has been great, though frustrating. But I know for sure ain't gonna solve this one on my own. Any suggestions you can offer will help preserve my sanity.

PS If it's any help I'm using Access 2000 and the following code DOES open the right form, and go to the specified record (ie 7):

Private Sub Union_more_Clic k()
DoCmd.OpenForm "Unions"
DoCmd.GoToRecor d , , acGoTo, 7
End Sub

I think I just need to find a way to pass an ID number to acGoTo. But I'll let you be the judge of that.
May 25 '07 #2
ADezii
8,834 Recognized Expert Expert
Hi
I'm trying to set up a button which will go to a string value in another form. Too simple, you say?

I have a form called Communications. In it there is a combo box called Abbreviation. This refers to the Row Source: qry_Union_Abbre viations to extract a short name, along with the ID number, from a Table.

The query has one bound column, the field ID is the first one, and it is indexed and a primary key (in the form "Unions" which I'm wanting to call).

So the simple beginner's task I set myself was to put a little button beside this combo box which, when clicked, would refer to the data in the Combo box and then open up the other form and go to the record whose value was that named in the Combo box.

Here's the code I have used for my On_Click Event Procedure:

Private Sub Union_more_Clic k()
intGlobalVariab le = [Union Abbreviation]
DoCmd.OpenForm "Unions"
DoCmd.GoToRecor d , , acGoTo, intGlobalVariab le
End Sub

On click I get error number 2498 - "an expression you entered is the wrong data type for one of the arguments".

In debugging I see the acGoTo value is "4" (seems to be always 4, no matter which record I start from) while the intGlobalVariab le is the text string in the combo box.

If I use strGlobalVariab le it makes no difference.

I've tried everything I've been able to find in forums, and the experience has been great, though frustrating. But I know for sure ain't gonna solve this one on my own. Any suggestions you can offer will help preserve my sanity.

PS If it's any help I'm using Access 2000 and the following code DOES open the right form, and go to the specified record (ie 7):

Private Sub Union_more_Clic k()
DoCmd.OpenForm "Unions"
DoCmd.GoToRecor d , , acGoTo, 7
End Sub

I think I just need to find a way to pass an ID number to acGoTo. But I'll let you be the judge of that.
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "Unions", acNormal, , "[ID] = " & Me![Abbreviation], acFormEdit, acWindowNormal
May 26 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
Try something like this instead.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Union_more_Click()
  2. Dim strCriteria As String
  3.    strCriteria = "[ID]=" & Me!Union_more 
  4.    DoCmd.OpenForm "Unions", , , strCriteria
  5.  
  6. End Sub
  7.  
May 26 '07 #4
Peter Tenk
6 New Member
Thanks very much for this, but no luck. I'm perplexed by the result. The error message said that it could not find a field by the name of Abbreviation. I double checked the Control Source. No typos. There IS a field called Abbreviation in the form called Unions.

Does your suggestion rely on some underlying relationship or link between the two forms?
May 26 '07 #5
Peter Tenk
6 New Member
Thanks for this, but I'm afraid it didn't work. On debugging the final strCriteria contains an empty value (if that's the right term). The field name [ID] is definitely right, so I don't get why. However it's also worth noting that the ID value in the Unions form will be different to the ID value in the form we start from (which is called Communications) .

Wince. Any suggestions?
May 26 '07 #6
ADezii
8,834 Recognized Expert Expert
Thanks very much for this, but no luck. I'm perplexed by the result. The error message said that it could not find a field by the name of Abbreviation. I double checked the Control Source. No typos. There IS a field called Abbreviation in the form called Unions.

Does your suggestion rely on some underlying relationship or link between the two forms?
I based the code on:
In it there is a combo box called Abbreviation.
It seems as though your Combo Box may not be named Abbreviation at all. I am not referring to the 'Control Source' for the Combo Box but the 'Name' of the Combo Box. They probably are not the same. To obtain the Name of the Combo Box: Form Design View ==> right click on the Combo Box ==> Properties ==> All Tab ==> 1st item is Name. Substitute it for Abbreviation in the line of code.
May 26 '07 #7
missinglinq
3,532 Recognized Expert Specialist
Please do not double post on the forum! It potentially wastes the time of the very people you're asking for help! The person responding on one post has no way of knowing what's been suggested to you on the other post, and whether or not the suggestion helped! You have mmccarthy and adezii both trying to help you, but neither is aware that the other has already made, essentially, the same suggestion, which isn't working!

If, after a reasonable time, you have not received help, you may move yur original post back up to the head of the queue, where it's likely to receive more attention, by simply posting a reply with the message "Bump!"
May 26 '07 #8
MMcCarthy
14,534 Recognized Expert Moderator MVP
Please do not double post on the forum! It potentially wastes the time of the very people you're asking for help! The person responding on one post has no way of knowing what's been suggested to you on the other post, and whether or not the suggestion helped! You have mmccarthy and adezii both trying to help you, but neither is aware that the other has already made, essentially, the same suggestion, which isn't working!

If, after a reasonable time, you have not received help, you may move yur original post back up to the head of the queue, where it's likely to receive more attention, by simply posting a reply with the message "Bump!"
I have merged both of these threads. Thanks Linq.

Mary
May 26 '07 #9
MMcCarthy
14,534 Recognized Expert Moderator MVP
Thanks for this, but I'm afraid it didn't work. On debugging the final strCriteria contains an empty value (if that's the right term). The field name [ID] is definitely right, so I don't get why. However it's also worth noting that the ID value in the Unions form will be different to the ID value in the form we start from (which is called Communications) .

Wince. Any suggestions?
In the form Unions what is the control name of the textbox which has the ID field?

Are you trying to open a record to the ID which matches the selected record in the combobox?

What field is the combobox bound to?
May 26 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2106
by: Robert Rozman | last post by:
Hi, I'm total php newbie and probably have trivial problem. I have following two scripts. First creates web form and should run second script with two arguments. But those two arguments don't get to second script, cause this line print "Please enter both phone number and name!";
24
2591
by: Xah Lee | last post by:
What is Expresiveness in a Computer Language 20050207, Xah Lee. In languages human or computer, there's a notion of expressiveness. English for example, is very expressive in manifestation, witness all the poetry and implications and allusions and connotations and dictions. There are a myriad ways to say one thing, fuzzy and warm and all. But when we look at what things it can say, its power of
0
823
by: David Marshall | last post by:
I am a relative newbie and can't seem to figure out how to get past this stumbling block. I am creating an unknown number of dynamic rows (min=0, max=10) in a table whoose cells are populated with SQL Server data. What is being displayed is basic information relating to Work Tickets. The final cell in each row gives the option(s) to view or update the particular record. What I wish to have happen is to pass the ticket number (the...
4
7672
by: Scott Lyons | last post by:
Hey all, Can someone help me figure out how to pass a dynamic array into a function? Its been giving me some trouble, and my textbook of course doesnt cover the issue. Its probably something simple, but its just not popping into my mind at the moment. My little snippet of code is below. Basically, the studentID array is dynamic so it will fit any length of a Student's Name. What I'm trying to do is place this chunk of code into a...
4
2345
imrosie
by: imrosie | last post by:
Hello All, (newbie)...I'm working on an Ordering app using the typical tables (customers, orders). I have a Search form to find existing customers prior to entering a new order. On the search form there's a combo control called 'custname' so that when a customer is located, the existing customer name is filled in and the account number goes into the Account control (from an autonumber field called CustomerID from Customer table). The rest of...
6
1408
by: BoscoPippa | last post by:
I'm an extreme newbie at C++ and am working on my final project for my beginner course. I have an issue, though, and I'm hoping I can get a nudge in the right direction. The program functions via a user menu: void menu(void) and looks like this: E - Enter number of trades by day................// int getTrades(void) V - View previously entered data...................// void viewTrades(trades) S - View a statistical summary of the...
13
2340
by: JBuckland | last post by:
Im trying to create a 7 segment display for a project in visual basic 2005 express edition. I have a 2 dimentional boolean which stores the values of each of the segments for a certain display. I have written a case statement for the first display and would like to use it for the other displays instead of having to copy the code. I have tried everything I can think of but can't get it to pass the name of the boolean array im trying to set the...
3
3370
by: MM | last post by:
Hi to all, I'm trying to import a tab separated values file onto Excel with the following script: import csv from pyExcelerator import * w = Workbook() worksheet = w.add_sheet('sim1')
1
1373
by: DeZZar | last post by:
where would I add that in? For example the line: vbNewLine & "Drawdown Amount:" & " $" & Forms!frm_Leaselocks! Amount the reference to Forms!frm_Leaselocks!Amount is where the currency amount is held. how do I tell it to read the format as well?
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.