I have been working with a database that was already created by somebody else, who now no longer works here, so I cant ask any questions.
None the less, there is a table 'Ascertainment' which prior to my changes new record was saved in the Table, but when you bring up the form it was blank, the input for new record consisted of Text Boxes.
I wanted to validate the data, and changed the text boxes to combo boxes, now new record does not save in the table at all, as well as does not show up in the form. Please Help, here is the Action code to when you click the 'Done' Button. - Option Compare Database
-
-
Private Sub cmdDone_Click()
-
-
Dim response As Integer
-
Dim strLinkCriteria As String
-
Dim curIDNum As String
-
Dim txtRqd As String
-
If IsNull(Me![txtIDNUMBER]) Then
-
curIDNum = ""
-
Else
-
curIDNum = Me![txtIDNUMBER]
-
End If
-
-
strLinkCriteria = "[IDNUMBER] = " & """" & curIDNum & """"
-
strFormName = "Main"
-
-
If Me.Dirty = True Then
-
'user has entered or made changes to data on form
-
response = MsgBox("Would you like to save changes?", vbYesNoCancel)
-
If response = vbYes Then
-
'check for required textboxes (tagged 1 on form) without entries
-
txtRqd = checkRqdEntries(Me.Name, 1)
-
If Not txtRqd = "" Then
-
MsgBox txtRqd & " requires data before you proceed.", vbCritical
-
Exit Sub
-
End If
-
DoCmd.Close acForm, Me.Name
-
'continue on to main page
-
If intaddentry = 1 Then
-
'open main page in entry mode
-
DoCmd.OpenForm "Main", , , , acFormAdd
-
[Forms]("Main")![IDNUMBER] = curIDNum
-
'Else
-
'open main page with corresponding record in contacts table
-
'DoCmd.OpenForm "Main", , , strLinkCriteria
-
End If
-
ElseIf response = vbNo Then
-
Me.Undo
-
DoCmd.Close acForm, Me.Name
-
'if user decides not to save new patient, switchboard will open
-
'otherwise:
-
'If Not intaddentry = 1 Then
-
'user has chosen not to save changes made to existing patient
-
' DoCmd.OpenForm "Main", , , strLinkCriteria
-
'End If
-
Else
-
'cancel
-
strFormName = "Ascertainment"
-
Exit Sub
-
End If
-
Else
-
'no changes have been made to the data on the form
-
DoCmd.Close acForm, Me.Name
-
'if user decides not to save new patient, switchboard will open
-
'otherwise:
-
'If Not intaddentry = 1 Then
-
' DoCmd.OpenForm "Main", , , strLinkCriteria
-
'End If
-
End If
-
End Sub
11 3206
Also I wanted to add that in the "Main" Form I have a button that leads to the "Ascertainm ent" form and here is the code to that button, just in case this helps with understanding why there is a problem. - Private Sub cmdAscertainment_Click()
-
Dim curID As String
-
Dim recordExists As Boolean
-
curID = Me![IDNUMBER]
-
-
run = MainNavigate()
-
If boolCancel = True Then
-
Exit Sub
-
Else
-
If run = False Then
-
DoCmd.Close acForm, Me.Name
-
Exit Sub
-
Else
-
recordExists = FindRecord("Ascertainment", "IDNUMBER", curID)
-
If recordExists Then
-
DoCmd.OpenForm "Ascertainment", , , "[IDNUMBER] = """ & curID & """"
-
Else
-
DoCmd.OpenForm "Ascertainment", , , , acFormAdd
-
[Forms]("Ascertainment")![txtIDNUMBER] = curID
-
End If
-
End If
-
End If
-
End Sub
Hello AndrewDB,
When including code in your thread, and especially when including such a long portion of code, please use the [code] tags provided, as indicated in the Reply Guidelines to the right of the Reply/Message window. They are simple to use: select your code text, then click on the # icon on menu bar of the Message window.
MODERATOR
The code you have posted doesn't have any references in it to the text boxes converted to combo boxes that you mentioned having changed. Also, there is a reference in Line 23 of your first post to a user defined function named: chkRqdEntries.. .
Please indicate what code you changed, and post the relevant code changes. Please also post the code for the chkRqdEntries function.
Regards,
Scott
Thats the thing, the only thing I have changed was not the actual code, but from the Form 'Ascertainment' where there were fields, I took them out and replaced them with combo boxes. Thats all, fortunately I have fixed the problem of new records not being recorded. Thats half the battle. But I still can not understand why entered records do not show up when I click on the 'Ascertainment' button from the 'Main' menu? Its just a blank form, even though the record exists in the Table.
Please Help.
Here is the code for the function you have asked: -
Option Compare Database
-
-
Function checkRqdEntries(frmName As String, tagNo As Integer) As String
-
Dim contrl As Control
-
checkRqdEntries = ""
-
For Each contrl In [Forms](frmName).Controls
-
If TypeName(contrl) = "TextBox" And contrl.Tag = tagNo Then
-
If IsNull(contrl) Then
-
checkRqdEntries = contrl.Name
-
Exit Function
-
End If
-
End If
-
Next contrl
-
End Function
-
Thank You for your Time
What's the control source of your combo boxes? Combo boxes have both a control source and a row source.
I'm assuming you have set the row source correctly, but nothing will initially show in the combo box if you do not set the control source.
Regards,
Scott
Row Source contains the two columns that are my 'Choices' with description that I want to display, and the corresponding code number that I want to store in the table.
Control Source is the reference to the variable/column where the information is being stored in the table. In one of the cases for example I have a combo box for 'Referred by' which is stored in my 'Ascertainment' table under variable REFDBY, which is the control source for that combo box.
So it does seem like there is reference to it, I just don't understand why it wont display, very strange.
Andrew
-
Option Compare Database
-
-
Function checkRqdEntries(frmName As String, tagNo As Integer) As String
-
Dim contrl As Control
-
checkRqdEntries = ""
-
For Each contrl In [Forms](frmName).Controls
-
If TypeName(contrl) = "TextBox" And contrl.Tag = tagNo Then
-
If IsNull(contrl) Then
-
checkRqdEntries = contrl.Name
-
Exit Function
-
End If
-
End If
-
Next contrl
-
End Function
-
I'm not still clear on exactly what you're doing here, but in Line # 7 of the above code you have a line
If TypeName(contrl ) = "TextBox" And contrl.Tag = tagNo Then
Since you've converted some textboxes to comboboxes you may need to modify this code to to include comboboxes.
Linq ;0)>
How would I do that?
Would it be like this?
If (TypeName(contrl ) = "TextBox" OR "ComboBox") And contrl.Tag = tagNo Then
?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mark |
last post by:
I have a working PHP/MySQL application used for data entry. The data
entry screen includes a "Save" button. The PHP code for this button
looks like this:
if (isset($_POST))
{
if ($_POST == "")
{
include ("InsertRecord.inc"); // Insert new record
}
|
by: elvin |
last post by:
Okay - apologize in advance for the length, but I want to make sure
all you knowledgeable and helpful people have all the details you need
to hopefully point my newbie rear in the right direction.
I've got a fairly complex (a lot more complex than originally
intended) database with three main tables. The database is designed
to track information about certain files. The tables are set up with
one to one relationships, primarily because...
|
by: Tim ffitch |
last post by:
Hi
Here is my setup. 5 users on NT4 workstations each with front end
Access 97 db linked to NT4 server which has back end data file.
A user selects a supplier from a pop up form. The main form is updated
with the supplier details. The user then moves to a new order and then
later returns to the first order. The supplier details are no longer
there for the first order.
|
by: MLH |
last post by:
Edit, Insert Object & choose Wave Object, the following
OLE object thing gets inserted onto the form...
Microsoft Sound Recorder
Version 5.1 (Build 2600.xpsp2.030422-1633: Service Pack 1)
Copyright 1981-2001 Microsoft Corporation
PCM 22.050 kHz, 8 Bit, Mono
If I double-click the icon-looking thing on the form after setting its
.Enabled property to true AND its .Verb property to -2, the Microsoft
|
by: Steve |
last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I
have code that sets the default value of each field to its current value. For a
new record, I can put the focus in any field to start. If I edit that field and
then click on the new record button in the navigation buttons, the form goes to
a new record and each field has the default value of the previous record. If I
put the focus in any field to start, edit that...
| |
by: kkrizl |
last post by:
I have a form that displays general information about an alarm permit
location. There's a subform that shows detailed information about
burglar alarms that have gone off at the location. When a new alarm is
entered on the subform, I want to print a report that shows the general
information and the alarms that were entered.
The record source for the form is the Mailing List table (key is Alarm
#).
The record source for the subform is the...
|
by: Kim Webb |
last post by:
I have a field on a form for project number. I basically want it to be
the next available number (ie 06010 then 06011 etc). In the form I
create a text box and under control source I put:
=!=
This does not work
I tried:
|
by: terry.statham |
last post by:
Hope someone can help me here.
I am fairly new to Access. I have set up a database relating to vehicle
movements prior to sale. I have a subform based on 'locations' table
which is linked to my main 'vehicles' tables through vehicleID.
Table 'Locations' has the following fields; LOcationID(PK), VehicleID,
Location, DateDueIn, ActualDateIN, DateDueOut, ActualDateOut.
I have set up form validation rules so that no dates can be entered
|
by: tekctrl |
last post by:
Anyone:
I have a simple MSAccess DB which was created from an old ASCII flatfile.
It works fine except for something that just started happening. I'll enter
info in a record, save the record, and try to move to another record and get
an Access error "Record is too large". The record is only half filled, with
many empty fields. If I remove the added data or delete some older data,
then it saves ok and works fine again. Whenever I'm...
|
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...
|
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: 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,...
|
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |