After displaying search results, I want to be able to double click the identity number field and then the input form SubmissionDetails becomes the display form for the results of the data matching value of the selected identity number. With my code below I get a data type mismatch error. Please help me....... - Private Sub IdentityNumber_Click()
-
On Error GoTo IdentityNumber_Click_Err
-
-
On Error Resume Next
-
If (Form.Dirty) Then
-
DoCmd.RunCommand acCmdSaveRecord
-
End If
-
If (MacroError.Number <> 0) Then
-
Beep
-
MsgBox MacroError.Description, vbOKOnly, ""
-
Exit Sub
-
End If
-
On Error GoTo 0
-
DoCmd.OpenForm "SubmissionDetails", acNormal, , "[IdentityNumber]=" & IdentityNumber, , acDialog
-
'DoCmd.OpenForm "SubmissionDetails", acNormal, "", "[IdentityNumber]=" & IIf(Nz(IdentityNumber.Value) = vbNullString, "No value.", IdentityNumber.Value & "."), , acDialog
-
-
'IIf(Nz(IdentityNumber.Value) = vbNullString, "No value.", "Value is " & IdentityNumber.Value & ".")
-
-
If (Not IsNull(IdentityNumber)) Then
-
TempVars.Add "CurrentID", "[IdentityNumber]"
-
End If
-
If (IsNull(IdentityNumber)) Then
-
TempVars.Add "CurrentID", "Nz(DMax(""[IdentityNumber]"",[Form].[RecordSource]),0)"
-
End If
-
DoCmd.Requery ""
-
DoCmd.SearchForRecord , "", acFirst, "[IdentityNumber]=" & TempVars!CurrentID
-
TempVars.Remove "CurrentID"
-
-
-
IdentityNumber_Click_Exit:
-
Exit Sub
-
-
IdentityNumber_Click_Err:
-
MsgBox Error$
-
Resume IdentityNumber_Click_Exit
-
-
End Sub
5 4300 NeoPa 32,556
Expert Mod 16PB
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it.
Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use the tags in future.
Administrator.
PS. Please indicate (at least) which line the reported error occurs on.
Thank you NeoPa. I tried to do so but my window would allow me to insert tags so I ended up sending without them. Anyway just figured out where the problem was. Instead of making the IdentityNumber on the right a string, I had made it a number. So I just put some quotes around it and it was solved.
My guess is that [IdentityNumber] is defined in your table as Text, which it should be, so your Where clause "[IdentityNumber]=" & IdentityNumber
needs to be "[IdentityNumber]= '" & Me.IdentityNumber & "'"
Linq ;0)>
Thanks missinglinq,
I realised that that was the problem. Thanks for the reply.
NeoPa 32,556
Expert Mod 16PB @Lebbsy
No worries then. Maybe this will help :
Tags are done as matching pairs where the opening one is surrounded by [...] and the closing one by [/...]. A set of buttons is available for ease of use in the Standard Editor (Not the Basic Editor). The one for the [ CODE ] tags has a hash (#) on it. You can choose which editor to use in your profile options (Look near the bottom of the page).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: W. Adam Glab |
last post by:
"DoCmd.OpenForm "Owner Master Form", acNormal, , , acReadOnly"
I am trying to open a form from within another form, however when i do that
the two field like for example"Owner_ID does not match...
|
by: chanchito_cojones |
last post by:
hi there,
I am needing some help with a database I am putting together. The database
works off of a main Form, which then has buttons on it that will open up
other forms. The problem I am having...
|
by: Lyn |
last post by:
Hi,
I have a Search input form which collects from the user a person's name. I
am using LIKE with a "%" suffix in the SQL so that the user does not have to
type in the full name. When they hit...
|
by: Thelma Lubkin |
last post by:
formA determines some_where and some_value and issues
docmd.close ,Me
docmd.openform "formB", , ,some_where, , ,some_value
formB receives the correct some_where and some_value
After...
|
by: John Welch |
last post by:
I have a command button with the following code:
DoCmd.OpenForm "frmSearchAssignments", , , "SearchAssignmentID = 1"
(SearchAssignmentID is the PK, auto number)
When it runs, the form opens but...
|
by: Mike |
last post by:
I am trying to open a search results form based on the input from a
prompt form. I am using the following code:
--- Begin Code ---
Private Sub btnSearch_Click()
'Dim Variable and assign data...
|
by: news.onet.pl |
last post by:
Hello!
I have a question concerning to open the reports.
I know that DoCmd.OpenReport is a obsolete form of opening the reports, but
how to implement opening reports in VB using another VB code?...
|
by: rdsandy |
last post by:
Hi,
I am using Access 2003. I have a list box on a form which has 6 columns in it, with data taken from a table. I have an unbound text box which holds the ID number for the selected item in the...
|
by: phill86 |
last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |