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 3185
Also I wanted to add that in the "Main" Form I have a button that leads to the "Ascertainment" 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
?
No, when using And/Or you have to include the complete evaluation expression - If (TypeName(contrl) = "TextBox" OR TypeName(contrl) = "ComboBox") And contrl.Tag = tagNo Then
Linq ;0)>
I have tried that as well, nothing changes. Still the when I click on the button the Form comes up with empty cells/combo boxes. How strange! WHY? Anybody?
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 ==...
|
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....
|
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...
|
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)...
|
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...
|
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...
|
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:
=!=...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
| |