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

Home Posts Topics Members FAQ

Record Not Saved In Table & Does not show up in the Form

10 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Private Sub cmdDone_Click()
  4.  
  5.     Dim response As Integer
  6.     Dim strLinkCriteria As String
  7.     Dim curIDNum As String
  8.     Dim txtRqd As String
  9.     If IsNull(Me![txtIDNUMBER]) Then
  10.         curIDNum = ""
  11.     Else
  12.         curIDNum = Me![txtIDNUMBER]
  13.     End If
  14.  
  15.     strLinkCriteria = "[IDNUMBER] = " & """" & curIDNum & """"
  16.     strFormName = "Main"
  17.  
  18.     If Me.Dirty = True Then
  19.         'user has entered or made changes to data on form
  20.         response = MsgBox("Would you like to save changes?", vbYesNoCancel)
  21.         If response = vbYes Then
  22.             'check for required textboxes (tagged 1 on form) without entries
  23.             txtRqd = checkRqdEntries(Me.Name, 1)
  24.             If Not txtRqd = "" Then
  25.                 MsgBox txtRqd & " requires data before you proceed.", vbCritical
  26.                 Exit Sub
  27.             End If
  28.             DoCmd.Close acForm, Me.Name
  29.             'continue on to main page
  30.             If intaddentry = 1 Then
  31.                 'open main page in entry mode
  32.                 DoCmd.OpenForm "Main", , , , acFormAdd
  33.                 [Forms]("Main")![IDNUMBER] = curIDNum
  34.             'Else
  35.                 'open main page with corresponding record in contacts table
  36.                 'DoCmd.OpenForm "Main", , , strLinkCriteria
  37.             End If
  38.         ElseIf response = vbNo Then
  39.             Me.Undo
  40.             DoCmd.Close acForm, Me.Name
  41.             'if user decides not to save new patient, switchboard will open
  42.             'otherwise:
  43.             'If Not intaddentry = 1 Then
  44.                 'user has chosen not to save changes made to existing patient
  45.             '    DoCmd.OpenForm "Main", , , strLinkCriteria
  46.             'End If
  47.         Else
  48.             'cancel
  49.             strFormName = "Ascertainment"
  50.             Exit Sub
  51.         End If
  52.     Else
  53.         'no changes have been made to the data on the form
  54.         DoCmd.Close acForm, Me.Name
  55.         'if user decides not to save new patient, switchboard will open
  56.         'otherwise:
  57.         'If Not intaddentry = 1 Then
  58.         '    DoCmd.OpenForm "Main", , , strLinkCriteria
  59.         'End If
  60.     End If
  61. End Sub
Mar 17 '08 #1
11 3206
andrewdb
10 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAscertainment_Click()
  2.     Dim curID As String
  3.     Dim recordExists As Boolean
  4.     curID = Me![IDNUMBER]
  5.  
  6.     run = MainNavigate()
  7.     If boolCancel = True Then
  8.         Exit Sub
  9.     Else
  10.         If run = False Then
  11.             DoCmd.Close acForm, Me.Name
  12.             Exit Sub
  13.         Else
  14.             recordExists = FindRecord("Ascertainment", "IDNUMBER", curID)
  15.             If recordExists Then
  16.                 DoCmd.OpenForm "Ascertainment", , , "[IDNUMBER] = """ & curID & """"
  17.             Else
  18.                 DoCmd.OpenForm "Ascertainment", , , , acFormAdd
  19.                 [Forms]("Ascertainment")![txtIDNUMBER] = curID
  20.             End If
  21.         End If
  22.     End If
  23. End Sub
Mar 17 '08 #2
Scott Price
1,384 Recognized Expert Top Contributor
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
Mar 17 '08 #3
andrewdb
10 New Member
Anyone?
Please?
Maybe?
Mar 18 '08 #4
Scott Price
1,384 Recognized Expert Top Contributor
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
Mar 18 '08 #5
andrewdb
10 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Function checkRqdEntries(frmName As String, tagNo As Integer) As String
  4.     Dim contrl As Control
  5.     checkRqdEntries = ""
  6.     For Each contrl In [Forms](frmName).Controls
  7.         If TypeName(contrl) = "TextBox" And contrl.Tag = tagNo Then
  8.             If IsNull(contrl) Then
  9.                 checkRqdEntries = contrl.Name
  10.                 Exit Function
  11.             End If
  12.         End If
  13.     Next contrl
  14. End Function
  15.  
Thank You for your Time
Mar 18 '08 #6
Scott Price
1,384 Recognized Expert Top Contributor
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
Mar 18 '08 #7
andrewdb
10 New Member
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
Mar 19 '08 #8
missinglinq
3,532 Recognized Expert Specialist
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Function checkRqdEntries(frmName As String, tagNo As Integer) As String
  4.     Dim contrl As Control
  5.     checkRqdEntries = ""
  6.     For Each contrl In [Forms](frmName).Controls
  7.         If TypeName(contrl) = "TextBox" And contrl.Tag = tagNo Then
  8.             If IsNull(contrl) Then
  9.                 checkRqdEntries = contrl.Name
  10.                 Exit Function
  11.             End If
  12.         End If
  13.     Next contrl
  14. End Function
  15.  
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)>
Mar 19 '08 #9
andrewdb
10 New Member
How would I do that?

Would it be like this?

If (TypeName(contrl ) = "TextBox" OR "ComboBox") And contrl.Tag = tagNo Then

?
Mar 19 '08 #10

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

Similar topics

9
4915
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 }
0
3195
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...
2
2188
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.
0
1946
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
15
4653
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...
1
2692
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...
27
3944
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:
1
1733
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
25
20546
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...
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
8626
tracyyun
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...
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...
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();...
0
4175
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...
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.