module

dr223

Registered User.
Local time
Today, 09:59
Joined
Nov 15, 2007
Messages
219
Hi there,

I have a sample database from this forum which has a module named Variable and contains


Public SearchID As Integer

this works well for the sample database where the onclick event on the form with the search details coded as below,

SearchID = List0
DoCmd.OpenForm "frmCustomersSearch"
DoCmd.GoToControl "ID"
DoCmd.Close acForm, "frmFirstName"
DoCmd.FindRecord SearchID

When the selected name is selected the record is opened on the main form.

I am using the same principle but it doesn't work for my case, and prompts the error on

SearchID = List0

it says Type mismatch.

Instead of "ID" I have "Student_ID". Also my Student_ID is in the form
ADF54634 which is not an interger therefore it needs to be changed...what exactly?

I tried just for testing to create a Student_ID with intergers but when I click the record from a list of names it doesn't bring up the record on the database. The old record is still there..

Any help will be highly appreciated...
 
Try

Public SearchID As String
 
Thanks Paul,

The error has disappeared, however, when I click another record with the same forename it is not popualated on the database.

The previous record is always there. the code am using is


Private Sub List0_Click()

SearchID = List0
DoCmd.OpenForm "stud_details"
DoCmd.GoToControl "Student_ID" (unique identifier for each student)
DoCmd.Close acForm, "frmForename"
DoCmd.FindRecord SearchID

End Sub


Any suggestions ...

Many thanks
 
list0 doesnt sound like an integer

what is its type?

ie which field of its datasource is it bound to

perhaps searchid should be a long - better than integer anyway, as integer could overflow easily
 
Hi,

List is bounded to a query which list names that match the search.

I tried the searchid to Long type mismatch is prompted. I reckon string is the correct syntax. The problem is sorted for the searchid mismatch, the only problem faced currently is that when a name is selected it is not retrieved on the database.

The old record is still there.

Any suggestions
 
Thank you guys it has been sorted the problem was at the bounding column

Many thanks
 
Try this:

DoCmd.OpenForm "stud_details", , , "Student_ID = '" & SearchID & "'"
 

Users who are viewing this thread

Back
Top Bottom