Filling in an incomplete record

G

Guest

I have a form which by a series of cascading combos get the user to select an
old record. I now want to enter something into one of that record's fields
using a text box. How do I tell that text box to add the data to the record
found in the combo above?

many thanks,

James
 
G

Guest

Bound combos are not a bad thing, but they can be problematic. The easiest
way to do this would be to assign the value to the text box in the After
Update event of the combo:

Me.MyTextBox = Me.MyCombo
 
G

Guest

I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks
 
G

Guest

Bind the text box to a field in the recordset.

JamesHall said:
I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks
 
G

Guest

Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks
 
G

Guest

Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If
 
G

Guest

i still ca;t get t working :'(

Klatuu said:
Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



JamesHall said:
Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks
 
G

Guest

What is happening now?

JamesHall said:
i still ca;t get t working :'(

Klatuu said:
Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



JamesHall said:
Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks

:

Bind the text box to a field in the recordset.

:

I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks

:

Bound combos are not a bad thing, but they can be problematic. The easiest
way to do this would be to assign the value to the text box in the After
Update event of the combo:

Me.MyTextBox = Me.MyCombo

:

I have a form which by a series of cascading combos get the user to select an
old record. I now want to enter something into one of that record's fields
using a text box. How do I tell that text box to add the data to the record
found in the combo above?

many thanks,

James
 
G

Guest

nothing is happening

its still not filling the field. It get me very frustrated now. why can you
not select a record from a combo cascade and then add something to one of the
fields!!

Klatuu said:
What is happening now?

JamesHall said:
i still ca;t get t working :'(

Klatuu said:
Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



:

Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks

:

Bind the text box to a field in the recordset.

:

I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks

:

Bound combos are not a bad thing, but they can be problematic. The easiest
way to do this would be to assign the value to the text box in the After
Update event of the combo:

Me.MyTextBox = Me.MyCombo

:

I have a form which by a series of cascading combos get the user to select an
old record. I now want to enter something into one of that record's fields
using a text box. How do I tell that text box to add the data to the record
found in the combo above?

many thanks,

James
 
G

Guest

You can. It is done all the time. Check these things:
The combo is unbound and is positioning to the correct record.
The text box is bound to the field you want it to update.
The text box is not changed until you move to the new record.

JamesHall said:
nothing is happening

its still not filling the field. It get me very frustrated now. why can you
not select a record from a combo cascade and then add something to one of the
fields!!

Klatuu said:
What is happening now?

JamesHall said:
i still ca;t get t working :'(

:

Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



:

Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks

:

Bind the text box to a field in the recordset.

:

I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks

:

Bound combos are not a bad thing, but they can be problematic. The easiest
way to do this would be to assign the value to the text box in the After
Update event of the combo:

Me.MyTextBox = Me.MyCombo

:

I have a form which by a series of cascading combos get the user to select an
old record. I now want to enter something into one of that record's fields
using a text box. How do I tell that text box to add the data to the record
found in the combo above?

many thanks,

James
 
G

Guest

I know it must be doable but i am clearly missing something really obvious
here. I can't think what it is....do you have a n example of what i want
because I can't spot anything similar in the templates

Klatuu said:
You can. It is done all the time. Check these things:
The combo is unbound and is positioning to the correct record.
The text box is bound to the field you want it to update.
The text box is not changed until you move to the new record.

JamesHall said:
nothing is happening

its still not filling the field. It get me very frustrated now. why can you
not select a record from a combo cascade and then add something to one of the
fields!!

Klatuu said:
What is happening now?

:

i still ca;t get t working :'(

:

Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



:

Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks

:

Bind the text box to a field in the recordset.

:

I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks

:

Bound combos are not a bad thing, but they can be problematic. The easiest
way to do this would be to assign the value to the text box in the After
Update event of the combo:

Me.MyTextBox = Me.MyCombo

:

I have a form which by a series of cascading combos get the user to select an
old record. I now want to enter something into one of that record's fields
using a text box. How do I tell that text box to add the data to the record
found in the combo above?

many thanks,

James
 
G

Guest

If you correctly implemented the code I posted, it should work. How about
you send back your version of the code and I'll take a look at it.

JamesHall said:
I know it must be doable but i am clearly missing something really obvious
here. I can't think what it is....do you have a n example of what i want
because I can't spot anything similar in the templates

Klatuu said:
You can. It is done all the time. Check these things:
The combo is unbound and is positioning to the correct record.
The text box is bound to the field you want it to update.
The text box is not changed until you move to the new record.

JamesHall said:
nothing is happening

its still not filling the field. It get me very frustrated now. why can you
not select a record from a combo cascade and then add something to one of the
fields!!

:

What is happening now?

:

i still ca;t get t working :'(

:

Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



:

Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks

:

Bind the text box to a field in the recordset.

:

I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks

:

Bound combos are not a bad thing, but they can be problematic. The easiest
way to do this would be to assign the value to the text box in the After
Update event of the combo:

Me.MyTextBox = Me.MyCombo

:

I have a form which by a series of cascading combos get the user to select an
old record. I now want to enter something into one of that record's fields
using a text box. How do I tell that text box to add the data to the record
found in the combo above?

many thanks,

James
 
G

Guest

I think I am getting omewhere with this now. only thing is i get runtime
error 3464. data type mismatch in criteria expression. refering to the
findfirst line.

any ideas?

Klatuu said:
Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



JamesHall said:
Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks
 
G

Guest

The FindFirst method is like all other Domain functions. You need to pass
the filter criteria with the syntax for the data type of the table field.
The code is expecting a text data type.

JamesHall said:
I think I am getting omewhere with this now. only thing is i get runtime
error 3464. data type mismatch in criteria expression. refering to the
findfirst line.

any ideas?

Klatuu said:
Your combo should position the recordset to make the selected record the
current record. Then you you put in the missing information at that time.
Here is an example of how to use a combo to postion to a selected record.
Use the combo's After Update event:

Dim rst AS Recordset

Set rst = Me.RecordsetClone
rst.FindFirst "[SomeField] = '" & Me.MyCombo & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing

Now you are postiioned on the selected record. Note the above code does not
deal with values in the combo that are not in the table. You use the Not In
List event for that. To get the the Not In List to fire, you have to set the
Limit To List property of the combo to Yes.

Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If



JamesHall said:
Just Binding to the field does nothing because it doesn;t know which record
to put it into. how do i get it to know what record has been selected by the
combo?

thanks

:

Bind the text box to a field in the recordset.

:

I think you may hae misunderstod what i am asking for. I have a record of a
job and i am trying to put the finish date and time it this jobs record.
Using my cascading combos, by asking for the employee and the date of the job
i have then got a selection in a combo of the jobs that person performed on
that day. they will then select the approriate one. this gives me the primary
key for the job. how do i then get my text box with the finish date in it to
put that date into this record under the finishdate field?

thanks

:

Bound combos are not a bad thing, but they can be problematic. The easiest
way to do this would be to assign the value to the text box in the After
Update event of the combo:

Me.MyTextBox = Me.MyCombo

:

I have a form which by a series of cascading combos get the user to select an
old record. I now want to enter something into one of that record's fields
using a text box. How do I tell that text box to add the data to the record
found in the combo above?

many thanks,

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top