This is what I'm trying to do. I created a form for a user to enter a name. The information is saved in SQL DB employees table. The employees table auto number is assign to global variable GBL_ID as shown is first code. By clicking the proceed button on the first form I can follow the GBL_ID variable to the second form in debug mode.
While hitting F8 I can follow the process until a I get an error message:
Object variable or with block variable not set.
What am I doing wrong? It's got to be so simple. Any help will be appreciated. Thanks.
-------------------------------------------------------------------------------------------------------
Private Sub Btn_Proceed_Cli ck()
On Error GoTo Err_Btn_Proceed _Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim strFields As String
Dim strQueryName As String
If IsEmpty(Trim(Me !Text31)) Or IsNull(Trim(Me! Text31)) Or Trim(Me!Text31) = "" Then
MsgBox "Please enter your First Name"
Exit Sub
End If
If IsEmpty(Trim(Me !Text33)) Or IsNull(Trim(Me! Text33)) Or Trim(Me!Text33) = "" Then
MsgBox "Please enter your Last Name"
Exit Sub
End If
DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'set ID to global value
GBL_ID = CInt(Me.Text48)
'Insert a new record and create a new query for CPA Table
DoCmd.RunSQL "Insert into CPA (ID) values (" & GBL_ID & ");"
strSQL = "Select * from CPA where ID = " & GBL_ID & " ;"
DoCmd.Close acForm, Me.Name
stDocName = "CPA_form_1 "
stLinkCriteria = "ID = " & GBL_ID
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Btn_Procee d_Click:
Exit Sub
Err_Btn_Proceed _Click:
MsgBox Err.Description
Resume Exit_Btn_Procee d_Click
End Sub
--------------------------------------------------------------------------------------------
Private Sub Continue1_butto n_Click()
On Error GoTo Err_Continue1_b utton_Click
Dim stDocName As String
Dim stLinkCriteria As String
'Validates Option Buttons have been chosen
If Me.Frame1.Value = 0 Then
MsgBox "Please recheck answer(s) to ensure option button was selected."
'Me.Frame1.Back Color = RGB(255, 0, 0)
Exit Sub
End If
'Insert a new record and create a new query for CPA Table CurrentDb.Execu te "Insert into CPA (Q1) values (" & Me.Frame1 & ");"
strSQL = "Select Q1 from CPA where ID = " & GBL_ID & " ;"
stDocName = "CPA_form_2 "
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Continue1_ button_Click:
Exit Sub
Err_Continue1_b utton_Click: MsgBox Err.Description
Resume Exit_Continue1_ button_Click
End Sub
0 1599 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Geoff Wickens |
last post by:
I am quite new to all this but am trying to create a database driven site. I
have been able to use information from my sample database but I now want to
be able to insert data into it. At present I put the data into my local copy
of the access database and then upload it again to my server - not an ideal
solution!
I have tried using the INSERT command and it works fine if I enter the data
into the statement. What I really want to do is...
|
by: Miranda |
last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The
problem is I need to insert those passwords into an Access database of
327 clients.
I have the random password program generating the 327 passwords, but
have had no luck inserting them.
===============================================
Here is the code that generates the passwords:
===============================================
<% Option Explicit %>
|
by: Marko Poutiainen |
last post by:
Situation:
We had to make our SQLServer 2000 database multi-lingual. That is, certain
things (such as product names) in the database should be shown in the
language the user is using (Finnish, Swedish or English). There are about
a dozen tables with columns that need localization.
Doing this in the application level was a no-goer. It would have taken far
too much time (there is a *lot* of code and unfortunately most of the...
|
by: MLH |
last post by:
Why is that?
If I choose the tiny check boxes which are hard to
hit with a mouse, it works fine. But option buttions,
shich can be sized big enough for people with limited
sight and dexterity to hit - they don't work at all.
Its true. I created 'em with the built-in wizard furnished
with Access 97 but they do not work. I put 12 of 'em
in the group, labeled the months of the year and giving
|
by: Stephen D Cook |
last post by:
What I am trying to do is have a set of option buttons which are
required to click one. If the person doesn't click any before insert,
they get an error. If they do click one, it inserts into the field in
the table and then clears the form for the next entry.
I have a form tied to a table. In the table is a lookup field.
In the form I have a frame with 5 option buttons in it.
Outside the frame I have a text box.
I bound the text box to...
| |
by: Stephen D Cook |
last post by:
In my form I have an option group with 3 option buttons. My form is
tied to a table. the options are Temp, Permanent and Overtime.
I have these inside a frame. I have an AddRecord button to enter the
data into the table. After the record is Added the option buttons are
emptied.
I want to require the person to click one of the option buttons, which
enters the type of employee it is.
In the click event of the AddRecord button I have the...
|
by: clinttoris |
last post by:
Hello,
If someone could help me it would be appreciated as I am not having
much luck.
I'm struggling with my asp code and have some questions relating to asp
and oracle database.
First question. I have a web survey that I am working on and have
successfully dynamically taken the info from a database, displayed it
on the screen and then taken the users answers and inserted them into a
|
by: rcoco |
last post by:
Hi,
I want to share this problem. I have a datagrid that will help me
Insert data into sql database. So I made a button On my form so that
when I press the button a new row on datagrid should be created and I
could be able to insert data. But with this code below I've failed
could someone help me and tell me where I'm going wrong:
private void Page_Load(object sender, System.EventArgs e)
{
if (! IsPostBack)
|
by: sialater |
last post by:
Hello,
I realise there are a lot of topics related to this problem but many of what I have found has run cold or unresolved. What I have is an addressbook clone where there are groups which have members. I have this formatted in a way where the groups are in a drop down box. Once a group is selected, the two selection boxes below are refreshed with those who are members or non members of the selected group. The user has the ability to...
|
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...
|
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...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |